lua-users home
lua-l archive

Re: [ANN] Lua 5.3.0 (rc3) now available

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


> You are right, looks like pow() does strange things with a base of zero:
> 
> [...]
> 0 -3 -inf inf
> /usr/local/bin/lua: math.lua:155: assertion failed!
In fact, systems have conflicts about it:
The POSIX documentation says this:
 For y an odd integer < 0, if x is ±0, a pole error shall occur and
 ±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL shall be returned for pow(),
 powf(), and powl(), respectively.
So, +0^-3 should be +inf. But the ISO documentation does not include
these details. It only says that "A domain error may occur if x is zero
and y is less than or equal to zero.". So, it seems more honest to exclude
those cases for the tests.
-- Roberto

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