lua-users home
lua-l archive

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


2013-07-24 16:16 GMT+02:00 David Demelier <demelier.david@gmail.com>:
> 2013/7/10 Lorenzo Donati <lorenzodonatibz@tiscali.it>:
>> On 10/07/2013 9.09, Dirk Laurie wrote:
>>>
>>> 2013/7/6 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>>>>
>>>> Lua 5.3.0 (work1) is now available for testing at
>>>>          http://www.lua.org/work/lua-5.3.0-work1.tar.gz
>>>
>>>
>>> The values of MAX_INTEGER and MIN_INTEGER from llimits.h need to
>>> be accessible to Lua programs, maybe math.maxint, math.minint.
>>>
>>>
>> in another message Roberto stated that the width of both ints and floats
>> is available as:
>>
>> debug.numbits'i'
>> debug.numbits'f'
>>
>> Since 2's complement is assumed, you can compute them indirectly as
>>
>> IBITS = debug.numbits'i'
>> MAX_INT = 2^(IBITS-1)-1
>> MIN_INT = -2^(IBITS-1)
>>
>
> I don't understand why they put this in the debug library. So when you
> want to use that limits you need to pull debug? Even in a release
> code? No.

I have just been documenting some of my code, and was typing the
sentence  "Numbers should be such that no precision is lost in
addition, e.g. integers not too close to M" when I remembered this
thread. Does nobody else miss math.maxint?