lua-users home
lua-l archive

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


> And can a Lua that has been stripped of proper nan and inf functionality
> still even be called Lua? Also, with -ffast-math, Lua code still expects
> certain behaviour (via luai_numisnan macro) instead of disabling all code
> paths having to do with nans.

The reference manual does not mention nan or inf, so, yes, it'd be Lua still.
The implementation does make a small concession to the existence of nan, but
if luai_numisnan always returns false the only consequence is that table
entries with nan keys will be inaccesible and will break next...

Here's a session with a patched Lua that ignores nan:

> k=math.sqrt(-1) print(k)
nan
> 
> a={}
> a[k]=23 print(a[k])
nil
> a[k]=45 print(a[k])
nil
> 
> for k,v in pairs(a) do print(k,v) end
invalid key to 'next'
stack traceback:
	[C]: in function '(for generator)'
	stdin:1: in main chunk
	[C]: ?
nan	23
>