| Modifier and Type | Field and Description |
|---|---|
| public static double | |
| public static double |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | |
| public static boolean | |
| public static double | closeFloor(double v)
Returns floor(v) except when v is very close to the next number, when it returns ceil(v); |
| public static double | Returns: x rounded.to round x, int decimal places n)Round the argument x to n decimal places. |
| CLOSE | back to summary |
|---|---|
| public static double CLOSE | |
| EPSILON | back to summary |
|---|---|
| public static double EPSILON | |
| ExtraMath | back to summary |
|---|---|
| public ExtraMath() | |
| close | back to summary |
|---|---|
| public static boolean close(double v, double w, double tol) Are v and w "close" to each other? Uses a scaled tolerance. | |
| close | back to summary |
|---|---|
| public static boolean close(double v, double w) | |
| closeFloor | back to summary |
|---|---|
| public static double closeFloor(double v) Returns floor(v) except when v is very close to the next number, when it returns ceil(v); | |
| round | back to summary |
|---|---|
| public static double round(double x, int n) Round the argument x to n decimal places. (Rounding is half-up in Python 2.) The method uses BigDecimal, to compute r(x*10n)*10-n, where r() round to the nearest integer. It takes some short-cuts for extreme values. For sufficiently small x*10n, the rounding is to zero, and the return value is a signed zero (same sign as x). Suppose x = a*2b, where the significand we must have a<2. Sufficiently small means such that n log210 < -(b+2). For sufficiently large x*10n, the adjustment of rounding is too small to affect the least significant bit. That is a*2b represents an amount greater than one, and rounding no longer affects the value, and the return is x. Since the matissa has 52 fractional bits, sufficiently large means such that n log210 > 52-b.
| |