mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Bug 775680 - Math.pow should use powi if the exponent is an integer-valued double. r=dvander
This commit is contained in:
parent
60351e8369
commit
ba908b4d16
@ -475,8 +475,13 @@ js_math_pow(JSContext *cx, unsigned argc, Value *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (vp[3].isInt32())
|
||||
z = powi(x, vp[3].toInt32());
|
||||
/*
|
||||
* Use powi if the exponent is an integer or an integer-valued double.
|
||||
* We don't have to check for NaN since a comparison with NaN is always
|
||||
* false.
|
||||
*/
|
||||
if (int32_t(y) == y)
|
||||
z = powi(x, int32_t(y));
|
||||
else
|
||||
z = pow(x, y);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user