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

Method sign

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

Source from the content-addressed store, hash-verified

601 }
602
603 private static Object sign(
604 Context cx, JSFunction f, Object nt, VarScope s, Object thisObj, Object[] args) {
605 double x = ScriptRuntime.toNumber(args, 0);
606 if (!Double.isNaN(x)) {
607 if (x == 0) {
608 if (1 / x > 0) {
609 return ScriptRuntime.zeroObj;
610 }
611 return ScriptRuntime.negativeZeroObj;
612 }
613 return Double.valueOf(Math.signum(x));
614 }
615 return ScriptRuntime.NaNobj;
616 }
617
618 private static Object sin(
619 Context cx, JSFunction f, Object nt, VarScope s, Object thisObj, Object[] args) {

Callers 2

testFloat16Function · 0.45
math-functions.jsFile · 0.45

Calls 3

toNumberMethod · 0.95
isNaNMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected