lua-users home
lua-l archive

Re: Unexpected calculation result with Lua53

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



On May 3, 2015, at 5:20 PM, <tonyp@acm.org> <tonyp@acm.org> wrote:

As to the response about needing "a correct result instead of a rough approximation" when using integers, from a purely theoretical point of view I might agree totally, but from a practical point of view, how in the world can a zero answer be considered more accurate than even a rough approximation that's a lot-lot-lot-lot closer to the real answer, is beyond me.

But is it really so bad? I agree with your point about a less sophisticated user being puzzled when a 64-bit integer wraps, but is it better to silently coerce to a float? A silent coercion also causes nasty things to happen; that nice factorial algorithm still generates incorrect results (as a result of FP precision), but now instead of the results being wildly wrong they are slightly wrong. Both are wrong, but which is more likely to go unnoticed?

—Tim


AltStyle によって変換されたページ (->オリジナル) /