lua-users home
lua-l archive

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

On Sun, Feb 20, 2011 at 07:53:53PM +0200, Francesco Abbate wrote:
> I have a very simple question. The default behaviour of Lua when a FP
> error is encountered is to not raise any error and set the result to
> NaN or Inf.
Don't pick on Lua.  Specialized numerical analysis languages like
Octave do it too.

> I found this behaviour quite unconvenient for numerical procedures
> when it is better to raise a (Lua) error as soon as the problem
> happens.
Most others find it convenient.  That's why it's the default behaviour.

> It is possible to easily modify Lua and/or LuaJIT2 for this purpose ?
Define "easily".  It's certainly possible.  

But the Lua way is to show the test for NaN explicitly your code.