summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/MathObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/MathObject.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/MathObject.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/MathObject.cpp b/Userland/Libraries/LibJS/Runtime/MathObject.cpp
index 5bfe6e12b5..05986f59e5 100644
--- a/Userland/Libraries/LibJS/Runtime/MathObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/MathObject.cpp
@@ -79,7 +79,7 @@ MathObject::~MathObject()
}
// 21.3.2.1 Math.abs ( x ), https://tc39.es/ecma262/#sec-math.abs
-JS_DEFINE_NATIVE_FUNCTION(MathObject::abs)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::abs)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -92,14 +92,14 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::abs)
}
// 21.3.2.27 Math.random ( ), https://tc39.es/ecma262/#sec-math.random
-JS_DEFINE_NATIVE_FUNCTION(MathObject::random)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::random)
{
double r = (double)get_random<u32>() / (double)UINT32_MAX;
return Value(r);
}
// 21.3.2.32 Math.sqrt ( x ), https://tc39.es/ecma262/#sec-math.sqrt
-JS_DEFINE_NATIVE_FUNCTION(MathObject::sqrt)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sqrt)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -108,7 +108,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sqrt)
}
// 21.3.2.16 Math.floor ( x ), https://tc39.es/ecma262/#sec-math.floor
-JS_DEFINE_NATIVE_FUNCTION(MathObject::floor)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::floor)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -117,7 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::floor)
}
// 21.3.2.10 Math.ceil ( x ), https://tc39.es/ecma262/#sec-math.ceil
-JS_DEFINE_NATIVE_FUNCTION(MathObject::ceil)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::ceil)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -129,7 +129,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::ceil)
}
// 21.3.2.28 Math.round ( x ), https://tc39.es/ecma262/#sec-math.round
-JS_DEFINE_NATIVE_FUNCTION(MathObject::round)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::round)
{
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
double integer = ::ceil(value);
@@ -139,7 +139,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::round)
}
// 21.3.2.24 Math.max ( ...args ), https://tc39.es/ecma262/#sec-math.max
-JS_DEFINE_NATIVE_FUNCTION(MathObject::max)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::max)
{
Vector<Value> coerced;
for (size_t i = 0; i < vm.argument_count(); ++i)
@@ -156,7 +156,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::max)
}
// 21.3.2.25 Math.min ( ...args ), https://tc39.es/ecma262/#sec-math.min
-JS_DEFINE_NATIVE_FUNCTION(MathObject::min)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::min)
{
Vector<Value> coerced;
for (size_t i = 0; i < vm.argument_count(); ++i)
@@ -173,7 +173,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::min)
}
// 21.3.2.35 Math.trunc ( x ), https://tc39.es/ecma262/#sec-math.trunc
-JS_DEFINE_NATIVE_FUNCTION(MathObject::trunc)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::trunc)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -184,7 +184,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::trunc)
}
// 21.3.2.30 Math.sin ( x ), https://tc39.es/ecma262/#sec-math.sin
-JS_DEFINE_NATIVE_FUNCTION(MathObject::sin)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sin)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -193,7 +193,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sin)
}
// 21.3.2.12 Math.cos ( x ), https://tc39.es/ecma262/#sec-math.cos
-JS_DEFINE_NATIVE_FUNCTION(MathObject::cos)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::cos)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -202,7 +202,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::cos)
}
// 21.3.2.33 Math.tan ( x ), https://tc39.es/ecma262/#sec-math.tan
-JS_DEFINE_NATIVE_FUNCTION(MathObject::tan)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::tan)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -211,7 +211,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::tan)
}
// 21.3.2.26 Math.pow ( base, exponent ), https://tc39.es/ecma262/#sec-math.pow
-JS_DEFINE_NATIVE_FUNCTION(MathObject::pow)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::pow)
{
auto base = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
auto exponent = TRY_OR_DISCARD(vm.argument(1).to_number(global_object));
@@ -265,7 +265,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::pow)
}
// 21.3.2.14 Math.exp ( x ), https://tc39.es/ecma262/#sec-math.exp
-JS_DEFINE_NATIVE_FUNCTION(MathObject::exp)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::exp)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -274,7 +274,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::exp)
}
// 21.3.2.15 Math.expm1 ( x ), https://tc39.es/ecma262/#sec-math.expm1
-JS_DEFINE_NATIVE_FUNCTION(MathObject::expm1)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::expm1)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -283,7 +283,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::expm1)
}
// 21.3.2.29 Math.sign ( x ), https://tc39.es/ecma262/#sec-math.sign
-JS_DEFINE_NATIVE_FUNCTION(MathObject::sign)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sign)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_positive_zero())
@@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sign)
}
// 21.3.2.11 Math.clz32 ( x ), https://tc39.es/ecma262/#sec-math.clz32
-JS_DEFINE_NATIVE_FUNCTION(MathObject::clz32)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::clz32)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
if (number == 0)
@@ -307,7 +307,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::clz32)
}
// 21.3.2.2 Math.acos ( x ), https://tc39.es/ecma262/#sec-math.acos
-JS_DEFINE_NATIVE_FUNCTION(MathObject::acos)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::acos)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan() || number.as_double() > 1 || number.as_double() < -1)
@@ -318,7 +318,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::acos)
}
// 21.3.2.3 Math.acosh ( x ), https://tc39.es/ecma262/#sec-math.acosh
-JS_DEFINE_NATIVE_FUNCTION(MathObject::acosh)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::acosh)
{
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
if (value < 1)
@@ -327,7 +327,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::acosh)
}
// 21.3.2.4 Math.asin ( x ), https://tc39.es/ecma262/#sec-math.asin
-JS_DEFINE_NATIVE_FUNCTION(MathObject::asin)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::asin)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero())
@@ -336,13 +336,13 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::asin)
}
// 21.3.2.5 Math.asinh ( x ), https://tc39.es/ecma262/#sec-math.asinh
-JS_DEFINE_NATIVE_FUNCTION(MathObject::asinh)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::asinh)
{
return Value(::asinh(TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double()));
}
// 21.3.2.6 Math.atan ( x ), https://tc39.es/ecma262/#sec-math.atan
-JS_DEFINE_NATIVE_FUNCTION(MathObject::atan)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::atan)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero())
@@ -355,7 +355,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::atan)
}
// 21.3.2.7 Math.atanh ( x ), https://tc39.es/ecma262/#sec-math.atanh
-JS_DEFINE_NATIVE_FUNCTION(MathObject::atanh)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::atanh)
{
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
if (value > 1 || value < -1)
@@ -364,7 +364,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::atanh)
}
// 21.3.2.21 Math.log1p ( x ), https://tc39.es/ecma262/#sec-math.log1p
-JS_DEFINE_NATIVE_FUNCTION(MathObject::log1p)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log1p)
{
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
if (value < -1)
@@ -373,13 +373,13 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log1p)
}
// 21.3.2.9 Math.cbrt ( x ), https://tc39.es/ecma262/#sec-math.cbrt
-JS_DEFINE_NATIVE_FUNCTION(MathObject::cbrt)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::cbrt)
{
return Value(::cbrt(TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double()));
}
// 21.3.2.8 Math.atan2 ( y, x ), https://tc39.es/ecma262/#sec-math.atan2
-JS_DEFINE_NATIVE_FUNCTION(MathObject::atan2)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::atan2)
{
auto constexpr three_quarters_pi = M_PI_4 + M_PI_2;
@@ -438,7 +438,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::atan2)
}
// 21.3.2.17 Math.fround ( x ), https://tc39.es/ecma262/#sec-math.fround
-JS_DEFINE_NATIVE_FUNCTION(MathObject::fround)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::fround)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -447,7 +447,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::fround)
}
// 21.3.2.18 Math.hypot ( ...args ), https://tc39.es/ecma262/#sec-math.hypot
-JS_DEFINE_NATIVE_FUNCTION(MathObject::hypot)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::hypot)
{
Vector<Value> coerced;
for (size_t i = 0; i < vm.argument_count(); ++i)
@@ -475,7 +475,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::hypot)
}
// 21.3.2.19 Math.imul ( x, y ), https://tc39.es/ecma262/#sec-math.imul
-JS_DEFINE_NATIVE_FUNCTION(MathObject::imul)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::imul)
{
auto a = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
auto b = TRY_OR_DISCARD(vm.argument(1).to_u32(global_object));
@@ -483,7 +483,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::imul)
}
// 21.3.2.20 Math.log ( x ), https://tc39.es/ecma262/#sec-math.log
-JS_DEFINE_NATIVE_FUNCTION(MathObject::log)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log)
{
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
if (value < 0)
@@ -492,7 +492,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log)
}
// 21.3.2.23 Math.log2 ( x ), https://tc39.es/ecma262/#sec-math.log2
-JS_DEFINE_NATIVE_FUNCTION(MathObject::log2)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log2)
{
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
if (value < 0)
@@ -501,7 +501,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log2)
}
// 21.3.2.22 Math.log10 ( x ), https://tc39.es/ecma262/#sec-math.log10
-JS_DEFINE_NATIVE_FUNCTION(MathObject::log10)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::log10)
{
auto value = TRY_OR_DISCARD(vm.argument(0).to_number(global_object)).as_double();
if (value < 0)
@@ -510,7 +510,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::log10)
}
// 21.3.2.31 Math.sinh ( x ), https://tc39.es/ecma262/#sec-math.sinh
-JS_DEFINE_NATIVE_FUNCTION(MathObject::sinh)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::sinh)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -519,7 +519,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::sinh)
}
// 21.3.2.13 Math.cosh ( x ), https://tc39.es/ecma262/#sec-math.cosh
-JS_DEFINE_NATIVE_FUNCTION(MathObject::cosh)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::cosh)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())
@@ -528,7 +528,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::cosh)
}
// 21.3.2.34 Math.tanh ( x ), https://tc39.es/ecma262/#sec-math.tanh
-JS_DEFINE_NATIVE_FUNCTION(MathObject::tanh)
+JS_DEFINE_OLD_NATIVE_FUNCTION(MathObject::tanh)
{
auto number = TRY_OR_DISCARD(vm.argument(0).to_number(global_object));
if (number.is_nan())