@Test public void testToNumber02() { assertEquals(0.0, ToNumber(false), 0.0); assertEquals(Double.POSITIVE_INFINITY, 1 / ToNumber(false), 0.0); assertEquals(1.0, ToNumber(true), 1.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; }