lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Tue, Jun 16, 2015 at 3:41 PM, James Chang <jcchang92@gmail.com> wrote:
Hi Everyone,

I'm relatively new to lua, and I'm wondering if there is a fix for this on 5.2.1:

> print(string.format('%d', 2^63))
9223372036854775807 [[ = 2^63 - 1 ]]

Anybody have a clue why this happens? Doesn't seem to be string.format related.
 

This should throw an error instead of printing a number, right?

The catch is that I'm being stuck working with 5.2 and a big-endian processor. I'm upgrading to 5.3.0 to see if it's fixed, and I run into another error while running the testsuite:

It checks:
assert(tonumber(string.format("%A", 0x1fffff.0)) == 0X1.FFFFFP+20)

Then gives the error:
$(@D)/src/lua: strings.lua:231: malformed number near '0x1fffff.0'
stack traceback:
       [C]: in function 'dofile'
       all.lua:153: in main chunk
       [C]: in ?

Is the malformed number here supposed to fail, or am I missing something?

Thanks,

James Chang