| 496 | } |
| 497 | |
| 498 | private static Object max( |
| 499 | Context cx, JSFunction f, Object nt, VarScope s, Object thisObj, Object[] args) { |
| 500 | double x = Double.NEGATIVE_INFINITY; |
| 501 | for (int i = 0; i != args.length; ++i) { |
| 502 | double d = ScriptRuntime.toNumber(args[i]); |
| 503 | // if (x < d) x = d; does not work due to -0.0 >= +0.0 |
| 504 | x = Math.max(x, d); |
| 505 | } |
| 506 | return ScriptRuntime.wrapNumber(x); |
| 507 | } |
| 508 | |
| 509 | private static Object min( |
| 510 | Context cx, JSFunction f, Object nt, VarScope s, Object thisObj, Object[] args) { |