lua-users home
lua-l archive

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

It was thus said that the Great Thomas Jericke once stated:
> On 03/07/2014 09:50 AM, Philipp Janda wrote:
> >
> > Floating and integral
> >
> >   When a value of floating type is converted to integral type, the 
> >fractional part is discarded.  If the value of the integral part 
> >cannot be represented by the integral type, the behavior is undefined. 
> >/23/
> >
> >Footnote /23/ is:
> >23. The remaindering operation done when a value of integral type is 
> >converted to unsigned type need not be done when a value of floating 
> >type is converted to unsigned type.  Thus the range of portable values 
> >is [0, U type _MAX +1).
> >
> >Looks clear-cut to me ...
> >
> >
> >Philipp
> Oh well, then I looked at the wrong place. So the behavior is undefined, 
> this means the P2020 is doing nothing that isn't allowed here, and maybe 
> the code in the vanilla Lua source should be changed accordingly.
> We were surprised that only we encountered the problem. I haven't found 
> anything on the list about it.

  I think I hit this problem a few days ago and mentioned it on the list
[1].  I did figure out that on a 64-bit system, not all 64-bit values will
survive intact through a double.  I wrote about it a bit more here:

  -spc (Is the P2020 a 64-bit CPU?)

[1]	Only one person responded, and that was a mistake.