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

Method max

lib/java/lang/StrictMath.java:488–501  ·  view source on GitHub ↗

Returns the most positive (closest to positive infinity) of the two arguments. Special cases: max(NaN, (anything)) = NaN max((anything), NaN) = NaN max(+0.0, -0.0) = +0.0 max(-0.0, +0.0) = +0.0 @param d1 t

(double d1, double d2)

Source from the content-addressed store, hash-verified

486 * @return the larger of {@code d1} and {@code d2}.
487 */
488 public static double max(double d1, double d2) {
489 if (d1 > d2)
490 return d1;
491 if (d1 < d2)
492 return d2;
493 /* if either arg is NaN, return NaN */
494 if (d1 != d2)
495 return Double.NaN;
496 /* max( +0.0,-0.0) == +0.0 */
497 if (d1 == 0.0
498 && ((Double.doubleToLongBits(d1) & Double.doubleToLongBits(d2)) & 0x8000000000000000L) == 0)
499 return 0.0;
500 return d1;
501 }
502
503 /**
504 * Returns the most positive (closest to positive infinity) of the two

Callers

nothing calls this directly

Calls 2

doubleToLongBitsMethod · 0.95
floatToIntBitsMethod · 0.95

Tested by

no test coverage detected