Returns the argument's ulp (unit in the last place). The size of a ulp of a double value is the positive distance between this value and the double value next larger in magnitude. For non-NaN x, ulp(-x) == ulp(x). Special cases: ulp(+0.0) = Double.MIN_VALUE
(double d)
| 929 | * @return the size of a ulp of the argument. |
| 930 | */ |
| 931 | public static double ulp(double d) { |
| 932 | // special cases |
| 933 | if (Double.isInfinite(d)) { |
| 934 | return Double.POSITIVE_INFINITY; |
| 935 | } else if (d == Double.MAX_VALUE || d == -Double.MAX_VALUE) { |
| 936 | return pow(2, 971); |
| 937 | } |
| 938 | d = abs(d); |
| 939 | return nextafter(d, Double.MAX_VALUE) - d; |
| 940 | } |
| 941 | |
| 942 | /** |
| 943 | * Returns the argument's ulp (unit in the last place). The size of a ulp of |
nothing calls this directly
no test coverage detected