@Test public void testToNumber03() { assertEquals(13.0, ToNumber(13), 0.0); assertEquals(-13.0, ToNumber(-13), 0.0); assertEquals(1.3, ToNumber(1.3), 0.0); assertEquals(-1.3, ToNumber(-1.3), 0.0); assertEquals(1.7976931348623157e308, ToNumber(Double.MAX_VALUE), 0.0); assertEquals(5e-324, ToNumber(Double.MIN_VALUE), 0.0); assertTrue(isNaN(ToNumber(NaN))); assertEquals(0.0, ToNumber(+0.0), 0.0); assertEquals(-0.0, ToNumber(-0.0), 0.0); assertEquals(Double.POSITIVE_INFINITY, ToNumber(Double.POSITIVE_INFINITY), 0.0); assertEquals(Double.NEGATIVE_INFINITY, ToNumber(Double.NEGATIVE_INFINITY), 0.0); }
static Double ToNumber(Object arg) { if (arg == null) { return 0.0d; } else if (Boolean.TRUE.equals(arg)) { return 1.0d; } else if (Boolean.FALSE.equals(arg)) { return 0.0d; } else if (arg instanceof String) { return ToNumber((String) arg); } else if (arg instanceof Number) { return ((Number) arg).doubleValue(); } Object primValue = ToPrimitive(arg, "Number"); return ToNumber(primValue).doubleValue(); }
JSAbstractOperations { static Double ToNumber(Object arg) { if (arg == null) { return 0.0d; } else if (Boolean.TRUE.equals(arg)) { return 1.0d; } else if (Boolean.FALSE.equals(arg)) { return 0.0d; } else if (arg instanceof String) { return ToNumber((String) arg); } else if (arg instanceof Number) { return ((Number) arg).doubleValue(); } Object primValue = ToPrimitive(arg, "Number"); return ToNumber(primValue).doubleValue(); } }
JSAbstractOperations { static Double ToNumber(Object arg) { if (arg == null) { return 0.0d; } else if (Boolean.TRUE.equals(arg)) { return 1.0d; } else if (Boolean.FALSE.equals(arg)) { return 0.0d; } else if (arg instanceof String) { return ToNumber((String) arg); } else if (arg instanceof Number) { return ((Number) arg).doubleValue(); } Object primValue = ToPrimitive(arg, "Number"); return ToNumber(primValue).doubleValue(); }  }
JSAbstractOperations { static Double ToNumber(Object arg) { if (arg == null) { return 0.0d; } else if (Boolean.TRUE.equals(arg)) { return 1.0d; } else if (Boolean.FALSE.equals(arg)) { return 0.0d; } else if (arg instanceof String) { return ToNumber((String) arg); } else if (arg instanceof Number) { return ((Number) arg).doubleValue(); } Object primValue = ToPrimitive(arg, "Number"); return ToNumber(primValue).doubleValue(); }   }
JSAbstractOperations { static Double ToNumber(Object arg) { if (arg == null) { return 0.0d; } else if (Boolean.TRUE.equals(arg)) { return 1.0d; } else if (Boolean.FALSE.equals(arg)) { return 0.0d; } else if (arg instanceof String) { return ToNumber((String) arg); } else if (arg instanceof Number) { return ((Number) arg).doubleValue(); } Object primValue = ToPrimitive(arg, "Number"); return ToNumber(primValue).doubleValue(); }   static final BigInteger UINT_MAX_VALUE; static final Double UINT_MAX_VALUE_D; static final BigInteger SINT_MAX_VALUE; static final BigInteger USHORT_MAX_VALUE; }