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

Method ulp

lib/java/lang/StrictMath.java:999–1008  ·  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

997 * @return the size of a ulp of the argument.
998 */
999 public static double ulp(double d) {
1000 // special cases
1001 if (Double.isInfinite(d)) {
1002 return Double.POSITIVE_INFINITY;
1003 } else if (d == Double.MAX_VALUE || d == -Double.MAX_VALUE) {
1004 return pow(2, 971);
1005 }
1006 d = Math.abs(d);
1007 return nextafter(d, Double.MAX_VALUE) - d;
1008 }
1009
1010 /**
1011 * 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