Test of all the JAVA math functions, including those specifically chosen not to be implemented as "Amount compatible."
The math functions tested:
| COMPARISON OPERATORS | Supported | Notes | |
| < | yes | Both sides of comparison operation must be same unit category (eg. ft and m) or unit-less ratios of units | |
| > | yes | Both sides of comparison operation must be same unit category (eg. ft and m) or unit-less ratios of units | |
| = | yes | Both sides of comparison operation must be same unit category (eg. ft and m) or unit-less ratios of units | |
|---|---|---|---|
| yes | Both sides of comparison operation must be same unit category (eg. ft and m) or unit-less ratios of units | ||
| ≥ | yes | Both sides of comparison operation must be same unit category (eg. ft and m) or unit-less ratios of units | |
| <= | yes | Both sides of comparison operation must be same unit category (eg. ft and m) or unit-less ratios of units | |
| max | yes | Returns the greater of two double values. Both values compared must be same unit category (eg. ft and m) or unit-less ratios of units | |
| min | yes | Returns the smaller of two double values. Both values compared must be same unit category (eg. ft and m) or unit-less ratios of units | |
| signum | yes | Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero | |
| OTHER OPERATORS | |||
| % (Modulus operator) | no | Both sides of modulo operation must be same unit category (eg. ft and m) or unit-less ratios of units | |
| — | no | same as the previous() function | |
| ++ | no | same as the next() | |
| RESULT FORMATTING | |||
| .setScale() | no | ||
| .toString() | no | ||
| copySign | yes | Returns the first argument with the sign of the second argument. | |
| toDegrees | no |
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. Use the form VAR.to("angleDegrees") instead |
|
| toRadians | no | Converts an angle measured in degrees to an approximately equivalent angle measured in radians. Use the form VAR.to("rad") instead | |
| TRIG FUNCTIONS | |||
| acos | yes | Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi | |
| asin | yes | Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2 | |
| atan | yes | Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2 | |
| atan2 | yes | atan2(y, x) Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta) | |
| sin | yes | ||
| cos | yes | ||
| tan | yes | ||
| cosh | yes | Returns the hyperbolic cosine | |
| sinh | yes | Returns the hyperbolic sine | |
| tanh | yes | ||
| STANDARD MATH FUNCTIONS | |||
| abs | yes | abolute value | |
| cbrt | no | the cube root | |
| exp | no* | Returns Euler's number e raised to the power of a value | |
| expm1 | no* | Returns ex - 1 | |
| getExponent | no* | Returns the unbiased exponent used in the representation of the input variable | |
| hypot | yes | Returns sqrt(x2 +y2) without intermediate overflow or underflow. Both variables need to be of same compatible category | |
| IEEEremainder | no* | Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard | |
| log | no | Returns the natural logarithm (base e) of an input value | |
| log10 | no | Returns the base 10 logarithm of an input value. | |
| log1p | no | Returns the natural logarithm of the sum of the argument and 1 | |
| nextAfter | no* | Returns the number adjacent to the first argument in the direction of the second argument | |
| nextUp | no* | Returns the value adjacent to d in the direction of positive infinity | |
| pow | yes | Returns the value of the first argument raised to the power of the second argument. Use Amount method .pow() instead of | |
| scalb | no* | Return d × 2scaleFactor rounded as if performed by a single correctly rounded multiply to a member of the double value set. | |
| sqrt | yes | Returns the correctly rounded positive square root of a double value | |
| ulp | no* | Returns the size of the unit in the last place of the argument | |
| ROUNDING FORMS | |||
| ceil | yes | Returns the smallest (closest to negative infinity) value that is greater than or equal to the argument and is equal to a mathematical integer | |
| floor | yes | Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer | |
| rint | yes | Returns the value that is closest in value to the argument and is equal to a mathematical integer | |
| round | yes | Returns the closest long to the argument, with ties rounding up |
* specifically decided not to implement specific math functions that (1) specific to computer representations of floats or doubles or (2) is most often relevant to pure unitless variables