MCPcopy Create free account
hub / github.com/mozilla/rhino / max

Method max

rhino/src/main/java/org/mozilla/javascript/NativeMath.java:498–507  ·  view source on GitHub ↗
(
            Context cx, JSFunction f, Object nt, VarScope s, Object thisObj, Object[] args)

Source from the content-addressed store, hash-verified

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) {

Callers 15

testCommonFloatValuesMethod · 0.80
BoundFunctionMethod · 0.80
buildMethod · 0.80
js_replaceAllMethod · 0.80
collectFieldsMethod · 0.80
parseMethod · 0.80
statementMethod · 0.80
autoInsertSemicolonMethod · 0.80
warnMissingSemiMethod · 0.80
warnTrailingCommaMethod · 0.80
buildMethod · 0.80
ensureCapacityMethod · 0.80

Calls 2

toNumberMethod · 0.95
wrapNumberMethod · 0.95

Tested by 2

testCommonFloatValuesMethod · 0.64
testFunction · 0.64