|
|
|
@ -30,55 +30,52 @@ impl IntrinsicObject for Math {
|
|
|
|
|
fn init(realm: &Realm) { |
|
|
|
|
let _timer = Profiler::global().start_event(Self::NAME, "init"); |
|
|
|
|
|
|
|
|
|
BuiltInBuilder::with_intrinsic_static_shape::<Self>( |
|
|
|
|
realm, |
|
|
|
|
&boa_builtins::MATH_OBJECT_STATIC_SHAPE, |
|
|
|
|
) |
|
|
|
|
.static_property(std::f64::consts::E) |
|
|
|
|
.static_property(std::f64::consts::LN_10) |
|
|
|
|
.static_property(std::f64::consts::LN_2) |
|
|
|
|
.static_property(std::f64::consts::LOG10_E) |
|
|
|
|
.static_property(std::f64::consts::LOG2_E) |
|
|
|
|
.static_property(std::f64::consts::PI) |
|
|
|
|
.static_property(std::f64::consts::FRAC_1_SQRT_2) |
|
|
|
|
.static_property(std::f64::consts::SQRT_2) |
|
|
|
|
.static_method(Self::abs, 1) |
|
|
|
|
.static_method(Self::acos, 1) |
|
|
|
|
.static_method(Self::acosh, 1) |
|
|
|
|
.static_method(Self::asin, 1) |
|
|
|
|
.static_method(Self::asinh, 1) |
|
|
|
|
.static_method(Self::atan, 1) |
|
|
|
|
.static_method(Self::atanh, 1) |
|
|
|
|
.static_method(Self::atan2, 2) |
|
|
|
|
.static_method(Self::cbrt, 1) |
|
|
|
|
.static_method(Self::ceil, 1) |
|
|
|
|
.static_method(Self::clz32, 1) |
|
|
|
|
.static_method(Self::cos, 1) |
|
|
|
|
.static_method(Self::cosh, 1) |
|
|
|
|
.static_method(Self::exp, 1) |
|
|
|
|
.static_method(Self::expm1, 1) |
|
|
|
|
.static_method(Self::floor, 1) |
|
|
|
|
.static_method(Self::fround, 1) |
|
|
|
|
.static_method(Self::hypot, 2) |
|
|
|
|
.static_method(Self::imul, 2) |
|
|
|
|
.static_method(Self::log, 1) |
|
|
|
|
.static_method(Self::log1p, 1) |
|
|
|
|
.static_method(Self::log10, 1) |
|
|
|
|
.static_method(Self::log2, 1) |
|
|
|
|
.static_method(Self::max, 2) |
|
|
|
|
.static_method(Self::min, 2) |
|
|
|
|
.static_method(Self::pow, 2) |
|
|
|
|
.static_method(Self::random, 0) |
|
|
|
|
.static_method(Self::round, 1) |
|
|
|
|
.static_method(Self::sign, 1) |
|
|
|
|
.static_method(Self::sin, 1) |
|
|
|
|
.static_method(Self::sinh, 1) |
|
|
|
|
.static_method(Self::sqrt, 1) |
|
|
|
|
.static_method(Self::tan, 1) |
|
|
|
|
.static_method(Self::tanh, 1) |
|
|
|
|
.static_method(Self::trunc, 1) |
|
|
|
|
.static_property(Self::NAME) |
|
|
|
|
.build(); |
|
|
|
|
BuiltInBuilder::with_intrinsic::<Self>(realm, &boa_builtins::MATH_OBJECT_STATIC_SHAPE) |
|
|
|
|
.static_property(std::f64::consts::E) |
|
|
|
|
.static_property(std::f64::consts::LN_10) |
|
|
|
|
.static_property(std::f64::consts::LN_2) |
|
|
|
|
.static_property(std::f64::consts::LOG10_E) |
|
|
|
|
.static_property(std::f64::consts::LOG2_E) |
|
|
|
|
.static_property(std::f64::consts::PI) |
|
|
|
|
.static_property(std::f64::consts::FRAC_1_SQRT_2) |
|
|
|
|
.static_property(std::f64::consts::SQRT_2) |
|
|
|
|
.static_method(Self::abs, 1) |
|
|
|
|
.static_method(Self::acos, 1) |
|
|
|
|
.static_method(Self::acosh, 1) |
|
|
|
|
.static_method(Self::asin, 1) |
|
|
|
|
.static_method(Self::asinh, 1) |
|
|
|
|
.static_method(Self::atan, 1) |
|
|
|
|
.static_method(Self::atanh, 1) |
|
|
|
|
.static_method(Self::atan2, 2) |
|
|
|
|
.static_method(Self::cbrt, 1) |
|
|
|
|
.static_method(Self::ceil, 1) |
|
|
|
|
.static_method(Self::clz32, 1) |
|
|
|
|
.static_method(Self::cos, 1) |
|
|
|
|
.static_method(Self::cosh, 1) |
|
|
|
|
.static_method(Self::exp, 1) |
|
|
|
|
.static_method(Self::expm1, 1) |
|
|
|
|
.static_method(Self::floor, 1) |
|
|
|
|
.static_method(Self::fround, 1) |
|
|
|
|
.static_method(Self::hypot, 2) |
|
|
|
|
.static_method(Self::imul, 2) |
|
|
|
|
.static_method(Self::log, 1) |
|
|
|
|
.static_method(Self::log1p, 1) |
|
|
|
|
.static_method(Self::log10, 1) |
|
|
|
|
.static_method(Self::log2, 1) |
|
|
|
|
.static_method(Self::max, 2) |
|
|
|
|
.static_method(Self::min, 2) |
|
|
|
|
.static_method(Self::pow, 2) |
|
|
|
|
.static_method(Self::random, 0) |
|
|
|
|
.static_method(Self::round, 1) |
|
|
|
|
.static_method(Self::sign, 1) |
|
|
|
|
.static_method(Self::sin, 1) |
|
|
|
|
.static_method(Self::sinh, 1) |
|
|
|
|
.static_method(Self::sqrt, 1) |
|
|
|
|
.static_method(Self::tan, 1) |
|
|
|
|
.static_method(Self::tanh, 1) |
|
|
|
|
.static_method(Self::trunc, 1) |
|
|
|
|
.static_property(Self::NAME) |
|
|
|
|
.build(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn get(intrinsics: &Intrinsics) -> JsObject { |
|
|
|
|