lua-users home
lua-l archive

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




On Mon, Jun 17, 2019 at 3:36 PM Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> According to the C standard, overflows in floating-point arithmetic are
> undefined behavior, too. (ISO/IEC 9899:1999 (E) 6.5-5.)
>
> If you are considering "turned on FPEs" as part of the game, would
> we have to handle other stuff like floating overflow and underflow
> traps, besides division by zero?

(Since the beginning, my question is not rhetorical. I really want to
know whether there is a concrete reason to add a special case in the
division by zero. It is very easy to do that, we only have to slightly
change the macro 'luai_numdiv'. But it seems weird to add code to
do what in my view all machines do by themselves without that extra
code. Checking floating overflows is another matter...)

-- Roberto


I don't believe there is, and that's what I had said before: I think that it's sufficient to document that floating point exceptions are handled according to the underlying C library and that Lua makes no additional promises. If you really want to make stricter promises then of course you have to put forth the effort to enforce those promises, but I don't think there's any noteworthy real-world scenario where this matters.

/s/ Adam