@GwtIncompatible // TODO private static BigInteger sqrtApproxWithDoubles(BigInteger x) { return DoubleMath.roundToBigInteger(Math.sqrt(DoubleUtils.bigToDouble(x)), HALF_EVEN); }
@GwtIncompatible // TODO private static BigInteger sqrtApproxWithDoubles(BigInteger x) { return DoubleMath.roundToBigInteger(Math.sqrt(DoubleUtils.bigToDouble(x)), HALF_EVEN); }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundIntegralDoubleToBigInteger() { for (double d : INTEGRAL_DOUBLE_CANDIDATES) { for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) { BigDecimal expected = new BigDecimal(d).setScale(0, mode); assertEquals(expected.toBigInteger(), DoubleMath.roundToBigInteger(d, mode)); } } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundExactIntegralDoubleToBigInteger() { for (double d : INTEGRAL_DOUBLE_CANDIDATES) { BigDecimal expected = new BigDecimal(d).setScale(0, UNNECESSARY); assertEquals(expected.toBigInteger(), DoubleMath.roundToBigInteger(d, UNNECESSARY)); } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundFractionalDoubleToBigInteger() { for (double d : FRACTIONAL_DOUBLE_CANDIDATES) { for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) { BigDecimal expected = new BigDecimal(d).setScale(0, mode); assertEquals(expected.toBigInteger(), DoubleMath.roundToBigInteger(d, mode)); } } }
@GwtIncompatible // TODO private static BigInteger sqrtApproxWithDoubles(BigInteger x) { return DoubleMath.roundToBigInteger(Math.sqrt(DoubleUtils.bigToDouble(x)), HALF_EVEN); }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundInfiniteToBigIntegerAlwaysFails() { for (RoundingMode mode : ALL_ROUNDING_MODES) { try { DoubleMath.roundToBigInteger(Double.POSITIVE_INFINITY, mode); fail("Expected ArithmeticException"); } catch (ArithmeticException expected) { } try { DoubleMath.roundToBigInteger(Double.NEGATIVE_INFINITY, mode); fail("Expected ArithmeticException"); } catch (ArithmeticException expected) { } } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundExactFractionalDoubleToBigIntegerFails() { for (double d : FRACTIONAL_DOUBLE_CANDIDATES) { try { DoubleMath.roundToBigInteger(d, UNNECESSARY); fail("Expected ArithmeticException"); } catch (ArithmeticException expected) { } } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundNaNToBigIntegerAlwaysFails() { for (RoundingMode mode : ALL_ROUNDING_MODES) { try { DoubleMath.roundToBigInteger(Double.NaN, mode); fail("Expected ArithmeticException"); } catch (ArithmeticException expected) { } } }
@Override public IInteger round() { return F.integer(DoubleMath.roundToBigInteger(fDouble, RoundingMode.HALF_EVEN)); // return F.integer(NumberUtil.toLong(Math.rint(fDouble))); }
private static BigInteger sqrtApproxWithDoubles(BigInteger x) { return DoubleMath.roundToBigInteger(Math.sqrt(DoubleUtils.bigToDouble(x)), HALF_EVEN); }
@GwtIncompatible // TODO private static BigInteger sqrtApproxWithDoubles(BigInteger x) { return DoubleMath.roundToBigInteger(Math.sqrt(DoubleUtils.bigToDouble(x)), HALF_EVEN); }
@GwtIncompatible("TODO") private static BigInteger sqrtApproxWithDoubles(BigInteger x) { return DoubleMath.roundToBigInteger(Math.sqrt(DoubleUtils.bigToDouble(x)), HALF_EVEN); }
@GwtIncompatible("TODO") private static BigInteger sqrtApproxWithDoubles(BigInteger x) { return DoubleMath.roundToBigInteger(Math.sqrt(DoubleUtils.bigToDouble(x)), HALF_EVEN); }
@Benchmark int roundToBigInteger(int reps) { int tmp = 0; for (int i = 0; i < reps; i++) { int j = i & ARRAY_MASK; tmp += DoubleMath.roundToBigInteger(positiveDoubles[j], mode).intValue(); } return tmp; }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundIntegralDoubleToBigInteger() { for (double d : INTEGRAL_DOUBLE_CANDIDATES) { for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) { BigDecimal expected = new BigDecimal(d).setScale(0, mode); assertEquals(expected.toBigInteger(), DoubleMath.roundToBigInteger(d, mode)); } } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundFractionalDoubleToBigInteger() { for (double d : FRACTIONAL_DOUBLE_CANDIDATES) { for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) { BigDecimal expected = new BigDecimal(d).setScale(0, mode); assertEquals(expected.toBigInteger(), DoubleMath.roundToBigInteger(d, mode)); } } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundExactIntegralDoubleToBigInteger() { for (double d : INTEGRAL_DOUBLE_CANDIDATES) { BigDecimal expected = new BigDecimal(d).setScale(0, UNNECESSARY); assertEquals(expected.toBigInteger(), DoubleMath.roundToBigInteger(d, UNNECESSARY)); } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundNaNToBigIntegerAlwaysFails() { for (RoundingMode mode : ALL_ROUNDING_MODES) { try { DoubleMath.roundToBigInteger(Double.NaN, mode); fail("Expected ArithmeticException"); } catch (ArithmeticException expected) {} } }
@GwtIncompatible // DoubleMath.roundToBigInteger(double, RoundingMode) public void testRoundExactFractionalDoubleToBigIntegerFails() { for (double d : FRACTIONAL_DOUBLE_CANDIDATES) { try { DoubleMath.roundToBigInteger(d, UNNECESSARY); fail("Expected ArithmeticException"); } catch (ArithmeticException expected) {} } }