MCPcopy Create free account
hub / github.com/davidgiven/luje / ulp

Method ulp

lib/java/lang/Math.java:931–940  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

isInfiniteMethod · 0.95
powMethod · 0.95
absMethod · 0.95
nextafterMethod · 0.95
isNaNMethod · 0.95
isInfiniteMethod · 0.95
nextafterfMethod · 0.95

Tested by

no test coverage detected