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)
| 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 |
nothing calls this directly
no test coverage detected