Issue #1240 - Part 5b - BigInt support for basic arithmetic operations. https://bugzilla.mozilla.org/show_bug.cgi?id=1471134 Parts 3-5.

This commit is contained in:
Brian Smith 2023-07-19 02:19:32 -05:00 committed by roytam1
commit 44b5d8dec3
8 changed files with 88 additions and 54 deletions

View file

@ -684,28 +684,22 @@ js::ecmaPow(double x, double y)
return pow(x, y);
}
bool
js::math_pow_handle(JSContext* cx, HandleValue base, HandleValue power, MutableHandleValue result)
{
double x;
if (!ToNumber(cx, base, &x))
return false;
double y;
if (!ToNumber(cx, power, &y))
return false;
double z = ecmaPow(x, y);
result.setNumber(z);
return true;
}
bool
js::math_pow(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return math_pow_handle(cx, args.get(0), args.get(1), args.rval());
double x;
if (!ToNumber(cx, args.get(0), &x))
return false;
double y;
if (!ToNumber(cx, args.get(1), &y))
return false;
double z = ecmaPow(x, y);
args.rval().setNumber(z);
return true;
}
uint64_t