@Test public void doesNotRoundValuesWithLessDigitsThanSpecified() throws Exception { assertThat(DoubleUtils.limitPrecision(0.12345678,9),equalTo(0.12345678)); }
static double limitPrecision(final double value, final int decimals) { final double scale = scale(decimals); final long scaledValue = DoubleMath.roundToLong(value*scale,RoundingMode.HALF_EVEN); return ((double)scaledValue)/scale; }
DoubleUtils { static double limitPrecision(final double value, final int decimals) { final double scale = scale(decimals); final long scaledValue = DoubleMath.roundToLong(value*scale,RoundingMode.HALF_EVEN); return ((double)scaledValue)/scale; } }
DoubleUtils { static double limitPrecision(final double value, final int decimals) { final double scale = scale(decimals); final long scaledValue = DoubleMath.roundToLong(value*scale,RoundingMode.HALF_EVEN); return ((double)scaledValue)/scale; } private  DoubleUtils(); }
DoubleUtils { static double limitPrecision(final double value, final int decimals) { final double scale = scale(decimals); final long scaledValue = DoubleMath.roundToLong(value*scale,RoundingMode.HALF_EVEN); return ((double)scaledValue)/scale; } private  DoubleUtils();  }
DoubleUtils { static double limitPrecision(final double value, final int decimals) { final double scale = scale(decimals); final long scaledValue = DoubleMath.roundToLong(value*scale,RoundingMode.HALF_EVEN); return ((double)scaledValue)/scale; } private  DoubleUtils();   }