I observed the following Javascript behavior:
> Math.pow(4, 2)
16
> Math.pow(4, 2.1)
18.37917367995256
> Math.pow(4, 0.5)
2
> Math.pow(-4, 2)
16
> Math.pow(-4, 2.1)
NaN
> Math.pow(-4, 0.5)
NaN
Why giving a negative number and a non-integer but rational number, makes Math.pow
to return NaN
?
For example, why Math.pow(4, 0.5)
is not NaN
but Math.pow(4, -0.5)
is NaN
?