@Test public void testToUInt1602() { assertEquals(0.0, ToUInt16(0.0), 0.0); assertEquals(1.0, ToUInt16(1.0), 0.0); assertEquals(65535.0, ToUInt16(-1.0), 0.0); assertEquals(65534.0, ToUInt16(65534.0), 0.0); assertEquals(65535.0, ToUInt16(65535.0), 0.0); assertEquals(0.0, ToUInt16(65536.0), 0.0); assertEquals(65535.0, ToUInt16(4294967295.0), 0.0); assertEquals(65534.0, ToUInt16(4294967294.0), 0.0); assertEquals(0.0, ToUInt16(4294967296.0), 0.0); assertEquals(32769.0, ToUInt16(-32767.0), 0.0); assertEquals(32768.0, ToUInt16(-32768.0), 0.0); assertEquals(32767.0, ToUInt16(-32769.0), 0.0); assertEquals(1.0, ToUInt16(-65535.0), 0.0); assertEquals(0.0, ToUInt16(-65536.0), 0.0); assertEquals(65535.0, ToUInt16(-65537.0), 0.0); assertEquals(65535.0, ToUInt16(65535.0), 0.0); assertEquals(0.0, ToUInt16(65536.0), 0.0); assertEquals(1.0, ToUInt16(65537.0), 0.0); assertEquals(65535.0, ToUInt16(131071.0), 0.0); assertEquals(0.0, ToUInt16(131072.0), 0.0); assertEquals(1.0, ToUInt16(131073.0), 0.0); }
static Double ToUInt16(Object arg) { Double number = ToNumber(arg); if (number.isNaN() || number.isInfinite() || number == 0.0) { return 0.0; } Double posInt = ToInteger(number); BigInteger posIntBig = new BigInteger(PLAIN_INTEGER_FORMAT.format(posInt)); BigInteger int16bit = posIntBig.mod(USHORT_MAX_VALUE); return int16bit.doubleValue(); }
JSAbstractOperations { static Double ToUInt16(Object arg) { Double number = ToNumber(arg); if (number.isNaN() || number.isInfinite() || number == 0.0) { return 0.0; } Double posInt = ToInteger(number); BigInteger posIntBig = new BigInteger(PLAIN_INTEGER_FORMAT.format(posInt)); BigInteger int16bit = posIntBig.mod(USHORT_MAX_VALUE); return int16bit.doubleValue(); } }
JSAbstractOperations { static Double ToUInt16(Object arg) { Double number = ToNumber(arg); if (number.isNaN() || number.isInfinite() || number == 0.0) { return 0.0; } Double posInt = ToInteger(number); BigInteger posIntBig = new BigInteger(PLAIN_INTEGER_FORMAT.format(posInt)); BigInteger int16bit = posIntBig.mod(USHORT_MAX_VALUE); return int16bit.doubleValue(); }  }
JSAbstractOperations { static Double ToUInt16(Object arg) { Double number = ToNumber(arg); if (number.isNaN() || number.isInfinite() || number == 0.0) { return 0.0; } Double posInt = ToInteger(number); BigInteger posIntBig = new BigInteger(PLAIN_INTEGER_FORMAT.format(posInt)); BigInteger int16bit = posIntBig.mod(USHORT_MAX_VALUE); return int16bit.doubleValue(); }   }
JSAbstractOperations { static Double ToUInt16(Object arg) { Double number = ToNumber(arg); if (number.isNaN() || number.isInfinite() || number == 0.0) { return 0.0; } Double posInt = ToInteger(number); BigInteger posIntBig = new BigInteger(PLAIN_INTEGER_FORMAT.format(posInt)); BigInteger int16bit = posIntBig.mod(USHORT_MAX_VALUE); return int16bit.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; }