summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/MathObject.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-06-16 13:17:06 +0300
committerLinus Groh <mail@linusgroh.de>2021-06-16 12:57:55 +0100
commit9127d8392761d81fc1a01309d62062d25a559386 (patch)
treee0b6713aff81c1508ea6ee2a65ef320b8814d05c /Userland/Libraries/LibJS/Runtime/MathObject.cpp
parent07992c8da68c29893864bc5160ebb14a8cb8c9f9 (diff)
downloadserenity-9127d8392761d81fc1a01309d62062d25a559386.zip
LibJS: Rename Value::{is_integer => is_integral_number}
The implementation matches the specification, so lets match the name as well. :^)
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/MathObject.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/MathObject.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/MathObject.cpp b/Userland/Libraries/LibJS/Runtime/MathObject.cpp
index 07d13e50e4..b20491b797 100644
--- a/Userland/Libraries/LibJS/Runtime/MathObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/MathObject.cpp
@@ -266,7 +266,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::pow)
if (base.is_positive_infinity())
return exponent.as_double() > 0 ? js_infinity() : Value(0);
if (base.is_negative_infinity()) {
- auto is_odd_integral_number = exponent.is_integer() && (exponent.as_i32() % 2 != 0);
+ auto is_odd_integral_number = exponent.is_integral_number() && (exponent.as_i32() % 2 != 0);
if (exponent.as_double() > 0)
return is_odd_integral_number ? js_negative_infinity() : js_infinity();
else
@@ -275,7 +275,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::pow)
if (base.is_positive_zero())
return exponent.as_double() > 0 ? Value(0) : js_infinity();
if (base.is_negative_zero()) {
- auto is_odd_integral_number = exponent.is_integer() && (exponent.as_i32() % 2 != 0);
+ auto is_odd_integral_number = exponent.is_integral_number() && (exponent.as_i32() % 2 != 0);
if (exponent.as_double() > 0)
return is_odd_integral_number ? Value(-0.0) : Value(0);
else
@@ -301,7 +301,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::pow)
return js_infinity();
}
VERIFY(exponent.is_finite_number() && !exponent.is_positive_zero() && !exponent.is_negative_zero());
- if (base.as_double() < 0 && !exponent.is_integer())
+ if (base.as_double() < 0 && !exponent.is_integral_number())
return js_nan();
return Value(::pow(base.as_double(), exponent.as_double()));
}