lua-users home
lua-l archive

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


On 26 June 2015 at 10:22, James Chang <jcchang92@gmail.com> wrote:
>
>
> On Thu, Jun 25, 2015 at 4:31 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
>>
>> Am 26.06.2015 um 01:04 schröbte James Chang:
>>>
>>> What regressions are the developers trying to catch with this test?
>>>
>>> assert(not pcall(string.format, "%d", 2^63))
>>
>>
>> A signed 64-bit integer usually can represent numbers from -2^63 up to
>> +2^63-1. 2^63 is just out of range.
>
>
> Correct, but this is more of a meta(?) question. Why include this if lua is
> intended for x86 chipsets if the behavior for signed long long is always
> this way?

The test is to make sure that an error is thrown. i.e.

> string.format("%d", 2^63)
stdin:1: bad argument #2 to 'format' (number has no integer representation)
stack traceback:
    [C]: in function 'string.format'
    stdin:1: in main chunk
    [C]: in ?