Pow() returns NaN on negative decimal powers
Monkey Forums/Monkey Bug Reports/Pow() returns NaN on negative decimal powers
| ||
Tested on HTML5 Chrome,and GLFW both Mac Lion, Monkey Version 66 Pow() returns NaN on negative decimal powers , eg .1.0 is ok but rasing a negative value to 0.5 or 1.1 returns NaN Strict Function Main:Int() For Local i:Float = -2 To 2 Step 0.01 Local r:Float = Pow(i,1.1) Print r next Return 0 End Function |
| ||
Those numbers are undefined. Some of these make sense mathematically, such as x^2 being the same as x*x. So Pow( -x, 2 ) is okay. But Pow( negative, 0.5 ) would be the square root of a negative number, so it fails. Likewise Pow( x, 1.1 ) can't work if x is negative. It would be the same as x * ( tenth root of x ). That fails for the same reason as square root of x. |
| ||
Ok, thanks, not a bug then. And it explains why I end up doing this to create a super-ellipsis: x = Cos(a) y = Sin(a) cpx = (Pow(Abs(x) ,factor)) * Sgn(x)) cpy = (Pow(Abs(y) ,factor)) * Sgn(y)) |