We all know that 00 is indeterminate.
But, javascript says that:
Math.pow(0, 0) === 1 // true
The C language definition says (7.12.7.4/2):
A domain error may occur if x is zero and y is zero.
It also says (7.12.1/2):
On a domain error, the function returns an implementation-defined value; if the integer expression math_errhandling & MATH_ERRNO is nonzero, the integer expression errno acquires the value EDOM; if the integer expression math_errhandling & MATH_ERREXCEPT is nonzero, the ‘‘invalid’’ floating-point exception is raised.
By default, the value of math_errhandling
is MATH_ERRNO
, so check errno
for the value EDOM
.