MCPcopy Create free account
hub / github.com/mozilla/rhino / NativeMath

Class NativeMath

rhino/src/main/java/org/mozilla/javascript/NativeMath.java:19–659  ·  view source on GitHub ↗

This class implements the Math native object. See ECMA 15.8. @author Norris Boyd

Source from the content-addressed store, hash-verified

17 * @author Norris Boyd
18 */
19final class NativeMath extends ScriptableObject {
20 @Serial private static final long serialVersionUID = -8838847185801131569L;
21
22 private static final String MATH_TAG = "Math";
23 private static final double LOG2E = 1.4426950408889634;
24 private static final Double Double32 = Double.valueOf(32d);
25
26 private static final ClassDescriptor DESCRIPTOR;
27
28 static {
29 DESCRIPTOR =
30 new ClassDescriptor.Builder(MATH_TAG)
31 .withProp(CTOR, "toSource", value("Math"))
32 .withMethod(CTOR, "abs", 1, NativeMath::abs)
33 .withMethod(CTOR, "acos", 1, NativeMath::acos)
34 .withMethod(CTOR, "acosh", 1, NativeMath::acosh)
35 .withMethod(CTOR, "asin", 1, NativeMath::asin)
36 .withMethod(CTOR, "asinh", 1, NativeMath::asinh)
37 .withMethod(CTOR, "atan", 1, NativeMath::atan)
38 .withMethod(CTOR, "atanh", 1, NativeMath::atanh)
39 .withMethod(CTOR, "atan2", 2, NativeMath::atan2)
40 .withMethod(CTOR, "cbrt", 1, NativeMath::cbrt)
41 .withMethod(CTOR, "ceil", 1, NativeMath::ceil)
42 .withMethod(CTOR, "clz32", 1, NativeMath::clz32)
43 .withMethod(CTOR, "cos", 1, NativeMath::cos)
44 .withMethod(CTOR, "cosh", 1, NativeMath::cosh)
45 .withMethod(CTOR, "exp", 1, NativeMath::exp)
46 .withMethod(CTOR, "expm1", 1, NativeMath::expm1)
47 .withMethod(CTOR, "f16round", 1, NativeMath::f16round)
48 .withMethod(CTOR, "floor", 1, NativeMath::floor)
49 .withMethod(CTOR, "fround", 1, NativeMath::fround)
50 .withMethod(CTOR, "hypot", 2, NativeMath::hypot)
51 .withMethod(CTOR, "imul", 2, NativeMath::imul)
52 .withMethod(CTOR, "log", 1, NativeMath::log)
53 .withMethod(CTOR, "log1p", 1, NativeMath::log1p)
54 .withMethod(CTOR, "log10", 1, NativeMath::log10)
55 .withMethod(CTOR, "log2", 1, NativeMath::log2)
56 .withMethod(CTOR, "max", 2, NativeMath::max)
57 .withMethod(CTOR, "min", 2, NativeMath::min)
58 .withMethod(CTOR, "pow", 2, NativeMath::pow)
59 .withMethod(CTOR, "random", 0, NativeMath::random)
60 .withMethod(CTOR, "round", 1, NativeMath::round)
61 .withMethod(CTOR, "sign", 1, NativeMath::sign)
62 .withMethod(CTOR, "sin", 1, NativeMath::sin)
63 .withMethod(CTOR, "sinh", 1, NativeMath::sinh)
64 .withMethod(CTOR, "sqrt", 1, NativeMath::sqrt)
65 .withMethod(CTOR, "tan", 1, NativeMath::tan)
66 .withMethod(CTOR, "tanh", 1, NativeMath::tanh)
67 .withMethod(CTOR, "trunc", 1, NativeMath::trunc)
68 .withProp(CTOR, "E", value(Math.E))
69 .withProp(CTOR, "PI", value(Math.PI))
70 .withProp(CTOR, "LN10", value(2.302585092994046))
71 .withProp(CTOR, "LN2", value(0.6931471805599453))
72 .withProp(CTOR, "LOG2E", value(LOG2E))
73 .withProp(CTOR, "LOG10E", value(0.4342944819032518))
74 .withProp(CTOR, "SQRT1_2", value(0.7071067811865476))
75 .withProp(CTOR, "SQRT2", value(1.4142135623730951))
76 .withProp(CTOR, SymbolKey.TO_STRING_TAG, value("Math", DONTENUM | READONLY))

Callers

nothing calls this directly

Calls 5

withPropMethod · 0.80
withMethodMethod · 0.80
valueOfMethod · 0.45
buildMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected