/
Math.java
205 lines (204 loc) · 7.94 KB
/
Math.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
package def.js;
@jsweet.lang.Interface
public abstract class Math extends def.js.Object {
/** The mathematical constant e. This is Euler's number, the base of natural logarithms. */
public static double E;
/** The natural logarithm of 10. */
public static double LN10;
/** The natural logarithm of 2. */
public static double LN2;
/** The base-2 logarithm of e. */
public static double LOG2E;
/** The base-10 logarithm of e. */
public static double LOG10E;
/** Pi. This is the ratio of the circumference of a circle to its diameter. */
public static double PI;
/** The square root of 0.5, or, equivalently, one divided by the square root of 2. */
public static double SQRT1_2;
/** The square root of 2. */
public static double SQRT2;
/**
* Returns the absolute value of a number (the value without regard to whether it is positive or negative).
* For example, the absolute value of -5 is the same as the absolute value of 5.
* @param x A numeric expression for which the absolute value is needed.
*/
native public static double abs(double x);
/**
* Returns the arc cosine (or inverse cosine) of a number.
* @param x A numeric expression.
*/
native public static double acos(double x);
/**
* Returns the arcsine of a number.
* @param x A numeric expression.
*/
native public static double asin(double x);
/**
* Returns the arctangent of a number.
* @param x A numeric expression for which the arctangent is needed.
*/
native public static double atan(double x);
/**
* Returns the angle (in radians) from the X axis to a point.
* @param y A numeric expression representing the cartesian y-coordinate.
* @param x A numeric expression representing the cartesian x-coordinate.
*/
native public static double atan2(double y, double x);
/**
* Returns the smallest number greater than or equal to its numeric argument.
* @param x A numeric expression.
*/
native public static double ceil(double x);
/**
* Returns the cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double cos(double x);
/**
* Returns e (the base of natural logarithms) raised to a power.
* @param x A numeric expression representing the power of e.
*/
native public static double exp(double x);
/**
* Returns the greatest number less than or equal to its numeric argument.
* @param x A numeric expression.
*/
native public static double floor(double x);
/**
* Returns the natural logarithm (base e) of a number.
* @param x A numeric expression.
*/
native public static double log(double x);
/**
* Returns the larger of a set of supplied numeric expressions.
* @param values Numeric expressions to be evaluated.
*/
native public static double max(double... values);
/**
* Returns the smaller of a set of supplied numeric expressions.
* @param values Numeric expressions to be evaluated.
*/
native public static double min(double... values);
/**
* Returns the value of a base expression taken to a specified power.
* @param x The base value of the expression.
* @param y The exponent value of the expression.
*/
native public static double pow(double x, double y);
/** Returns a pseudorandom number between 0 and 1. */
native public static double random();
/**
* Returns a supplied numeric expression rounded to the nearest number.
* @param x The value to be rounded to the nearest number.
*/
native public static double round(double x);
/**
* Returns the sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double sin(double x);
/**
* Returns the square root of a number.
* @param x A numeric expression.
*/
native public static double sqrt(double x);
/**
* Returns the tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double tan(double x);
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
* @param x A numeric expression.
*/
native public static double clz32(double x);
/**
* Returns the result of 32-bit multiplication of two numbers.
* @param x First number
* @param y Second number
*/
native public static double imul(double x, double y);
/**
* Returns the sign of the x, indicating whether x is positive, negative or zero.
* @param x The numeric expression to test
*/
native public static double sign(double x);
/**
* Returns the base 10 logarithm of a number.
* @param x A numeric expression.
*/
native public static double log10(double x);
/**
* Returns the base 2 logarithm of a number.
* @param x A numeric expression.
*/
native public static double log2(double x);
/**
* Returns the natural logarithm of 1 + x.
* @param x A numeric expression.
*/
native public static double log1p(double x);
/**
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
* the natural logarithms).
* @param x A numeric expression.
*/
native public static double expm1(double x);
/**
* Returns the hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double cosh(double x);
/**
* Returns the hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double sinh(double x);
/**
* Returns the hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double tanh(double x);
/**
* Returns the inverse hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double acosh(double x);
/**
* Returns the inverse hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double asinh(double x);
/**
* Returns the inverse hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
native public static double atanh(double x);
/**
* Returns the square root of the sum of squares of its arguments.
* @param values Values to compute the square root for.
* If no arguments are passed, the result is +0.
* If there is only one argument, the result is the absolute value.
* If any argument is +Infinity or -Infinity, the result is +Infinity.
* If any argument is NaN, the result is NaN.
* If all arguments are either +0 or −0, the result is +0.
*/
native public static double hypot(double... values);
/**
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
* If x is already an integer, the result is x.
* @param x A numeric expression.
*/
native public static double trunc(double x);
/**
* Returns the nearest single precision float representation of a number.
* @param x A numeric expression.
*/
native public static double fround(double x);
/**
* Returns an implementation-dependent approximation to the cube root of number.
* @param x A numeric expression.
*/
native public static double cbrt(double x);
native public static java.lang.String $getStatic(Symbol toStringTag);
}