/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/ |
D | RoundingModeTest.java | 21 import java.math.RoundingMode; 29 …ertEquals("valueOf failed for ROUND_CEILING", RoundingMode.valueOf(BigDecimal.ROUND_CEILING), Roun… in test_valueOfI() 30 …assertEquals("valueOf failed for ROUND_DOWN", RoundingMode.valueOf(BigDecimal.ROUND_DOWN), Roundin… in test_valueOfI() 31 …assertEquals("valueOf failed for ROUND_FLOOR", RoundingMode.valueOf(BigDecimal.ROUND_FLOOR), Round… in test_valueOfI() 32 …Equals("valueOf failed for ROUND_HALF_DOWN", RoundingMode.valueOf(BigDecimal.ROUND_HALF_DOWN), Rou… in test_valueOfI() 33 …Equals("valueOf failed for ROUND_HALF_EVEN", RoundingMode.valueOf(BigDecimal.ROUND_HALF_EVEN), Rou… in test_valueOfI() 34 …ertEquals("valueOf failed for ROUND_HALF_UP", RoundingMode.valueOf(BigDecimal.ROUND_HALF_UP), Roun… in test_valueOfI() 35 …als("valueOf failed for ROUND_UNNECESSARY", RoundingMode.valueOf(BigDecimal.ROUND_UNNECESSARY), Ro… in test_valueOfI() 36 …assertEquals("valueOf failed for ROUND_UP", RoundingMode.valueOf(BigDecimal.ROUND_UP), RoundingMod… in test_valueOfI() 38 RoundingMode.valueOf(13); in test_valueOfI() [all …]
|
D | BigDecimalConstructorsTest.java | 26 import java.math.RoundingMode; 102 RoundingMode rm = RoundingMode.CEILING; in testConstrBigIntegerMathContext() 119 RoundingMode rm = RoundingMode.CEILING; in testConstrBigIntegerScaleMathContext() 176 RoundingMode rm = RoundingMode.CEILING; in testConstrCharIntIntMathContext() 200 RoundingMode rm = RoundingMode.CEILING; in testConstrCharIntIntMathContextException1() 217 RoundingMode rm = RoundingMode.CEILING; in testConstrCharIntIntMathContextException2() 292 RoundingMode rm = RoundingMode.CEILING; in testConstrDoubleMathContext() 355 RoundingMode rm = RoundingMode.CEILING; in testConstrIntMathContext() 382 RoundingMode rm = RoundingMode.CEILING; in testConstrLongMathContext() 676 RoundingMode rm = RoundingMode.CEILING; in testConstrStringMathContext()
|
D | BigDecimalArithmeticTest.java | 23 import java.math.RoundingMode; 61 MathContext mc = new MathContext(5, RoundingMode.UP); in testAddMathContextEqualScalePosPos() 96 MathContext mc = new MathContext(5, RoundingMode.FLOOR); in testAddMathContextEqualScaleNegNeg() 131 MathContext mc = new MathContext(15, RoundingMode.CEILING); in testAddMathContextDiffScalePosNeg() 200 MathContext mc = new MathContext(15, RoundingMode.CEILING); in testSubtractMathContextEqualScalePosPos() 253 MathContext mc = new MathContext(17, RoundingMode.DOWN); in testSubtractMathContextDiffScalePosNeg() 289 MathContext mc = new MathContext(70, RoundingMode.HALF_DOWN); in testSubtractMathContextDiffScaleNegPos() 324 MathContext mc = new MathContext(40, RoundingMode.HALF_DOWN); in testMultiplyMathContextScalePosPos() 376 MathContext mc = new MathContext(53, RoundingMode.HALF_UP); in testMultiplyMathContextDiffScalePosNeg() 411 MathContext mc = new MathContext(47, RoundingMode.HALF_UP); in testMultiplyMathContextDiffScaleNegPos() [all …]
|
D | MathContextTest.java | 22 import java.math.RoundingMode; 32 MathContext mcIntRm6hd = new MathContext(6, RoundingMode.HALF_DOWN); in test_MathContextConstruction() 45 RoundingMode.HALF_UP, in test_MathContextConstruction() 48 RoundingMode.HALF_DOWN, mcIntRm6hd.getRoundingMode() ); in test_MathContextConstruction()
|
D | BigDecimalCompareTest.java | 26 import java.math.RoundingMode; 63 RoundingMode rm = RoundingMode.HALF_DOWN; in testAbsMathContextNeg() 79 RoundingMode rm = RoundingMode.HALF_EVEN; in testAbsMathContextPos() 374 RoundingMode rm = RoundingMode.FLOOR; in testPlusMathContextPositive() 404 RoundingMode rm = RoundingMode.CEILING; in testPlusMathContextNegative() 434 RoundingMode rm = RoundingMode.FLOOR; in testNegateMathContextPositive() 464 RoundingMode rm = RoundingMode.CEILING; in testNegateMathContextNegative()
|
/libcore/ojluni/src/test/java/math/RoundingMode/ |
D | RoundingModeTests.java | 23 package test.java.math.RoundingMode; 32 import java.math.RoundingMode; 47 for(RoundingMode rm: RoundingMode.values()) { in testRoundingMode() 48 Assert.assertEquals(RoundingMode.valueOf(rm.toString()), rm, in testRoundingMode() 53 Assert.assertEquals(RoundingMode.CEILING, RoundingMode.valueOf(BigDecimal.ROUND_CEILING), in testRoundingMode() 56 Assert.assertEquals(RoundingMode.DOWN, RoundingMode.valueOf(BigDecimal.ROUND_DOWN), in testRoundingMode() 59 Assert.assertEquals(RoundingMode.FLOOR, RoundingMode.valueOf(BigDecimal.ROUND_FLOOR), in testRoundingMode() 62 … Assert.assertEquals(RoundingMode.HALF_DOWN, RoundingMode.valueOf(BigDecimal.ROUND_HALF_DOWN), in testRoundingMode() 65 … Assert.assertEquals(RoundingMode.HALF_EVEN, RoundingMode.valueOf(BigDecimal.ROUND_HALF_EVEN), in testRoundingMode() 68 Assert.assertEquals(RoundingMode.HALF_UP, RoundingMode.valueOf(BigDecimal.ROUND_HALF_UP), in testRoundingMode() [all …]
|
/libcore/luni/src/test/java/libcore/java/math/ |
D | BigDecimalTest.java | 22 import java.math.RoundingMode; 69 BigDecimal rounded = bigDecimal.round(new MathContext(2, RoundingMode.FLOOR)); in testRound() 111 assertEquals("1.20", a.abs(new MathContext(3,RoundingMode.HALF_UP)).toPlainString()); in test54580() 118 zero = zero.setScale(2, RoundingMode.HALF_EVEN); in test191227() 121 other = other.setScale(2, RoundingMode.HALF_EVEN); in test191227() 127 private static void checkDivide(String expected, long n, long d, int scale, RoundingMode rm) { in checkDivide() 135 checkDivide("0", 1, Long.MIN_VALUE, 0, RoundingMode.DOWN); in testDivideRounding() 136 checkDivide("-1", 1, Long.MIN_VALUE, 0, RoundingMode.UP); in testDivideRounding() 137 checkDivide("-1", 1, Long.MIN_VALUE, 0, RoundingMode.FLOOR); in testDivideRounding() 138 checkDivide("0", 1, Long.MIN_VALUE, 0, RoundingMode.CEILING); in testDivideRounding() [all …]
|
D | OldBigDecimalConstructorsTest.java | 26 import java.math.RoundingMode; 38 RoundingMode rm = RoundingMode.CEILING; in testConstrBigIntegerMathContext() 52 mc = new MathContext(31, RoundingMode.UP); in testConstrBigIntegerMathContext() 58 mc = new MathContext(28, RoundingMode.DOWN); in testConstrBigIntegerMathContext() 64 mc = new MathContext(33, RoundingMode.CEILING); in testConstrBigIntegerMathContext() 70 mc = new MathContext(34, RoundingMode.FLOOR); in testConstrBigIntegerMathContext() 76 mc = new MathContext(34, RoundingMode.HALF_EVEN); in testConstrBigIntegerMathContext() 84 mc = new MathContext(34, RoundingMode.HALF_UP); in testConstrBigIntegerMathContext() 90 mc = new MathContext(34, RoundingMode.HALF_DOWN); in testConstrBigIntegerMathContext() 96 mc = new MathContext(34, RoundingMode.UNNECESSARY); in testConstrBigIntegerMathContext() [all …]
|
D | OldBigDecimalTest.java | 22 import java.math.RoundingMode; 81 setScale2 = setScale1.setScale(17, RoundingMode.CEILING); in test_setScaleILjava_math_RoundingMode() 90 setScale2 = setScale1.setScale(1, RoundingMode.CEILING); in test_setScaleILjava_math_RoundingMode() 95 setScale2 = setNeg.setScale(1, RoundingMode.CEILING); in test_setScaleILjava_math_RoundingMode() 102 setScale2 = setNeg.setScale(1, RoundingMode.DOWN); in test_setScaleILjava_math_RoundingMode() 108 setScale2 = setScale1.setScale(1, RoundingMode.DOWN); in test_setScaleILjava_math_RoundingMode() 114 setScale2 = setScale1.setScale(1, RoundingMode.FLOOR); in test_setScaleILjava_math_RoundingMode() 118 setScale2 = setNeg.setScale(1, RoundingMode.FLOOR); in test_setScaleILjava_math_RoundingMode() 125 setScale2 = setScale1.setScale(3, RoundingMode.HALF_DOWN); in test_setScaleILjava_math_RoundingMode() 131 setScale2 = setScale1.setScale(1, RoundingMode.HALF_DOWN); in test_setScaleILjava_math_RoundingMode() [all …]
|
D | OldBigDecimalArithmeticTest.java | 23 import java.math.RoundingMode; 32 mc = new MathContext(17, RoundingMode.FLOOR); in testAddMathContextNonTrivial() 44 mc = new MathContext(33, RoundingMode.UNNECESSARY); in testAddMathContextNonTrivial() 57 mc = new MathContext(17, RoundingMode.FLOOR); in testSubtractMathContextNonTrivial() 67 mc = new MathContext(33, RoundingMode.UNNECESSARY); in testSubtractMathContextNonTrivial() 80 mc = new MathContext(17, RoundingMode.FLOOR); in testMultiplyMathContextNonTrivial() 118 MathContext mc = new MathContext(5, RoundingMode.HALF_UP); in testPowMathContext() 128 mc = new MathContext(7, RoundingMode.FLOOR); in testPowMathContextNonTrivial() 135 mc = new MathContext(4, RoundingMode.FLOOR); in testPowMathContextNonTrivial() 142 mc = new MathContext(2, RoundingMode.UNNECESSARY); in testPowMathContextNonTrivial() [all …]
|
D | OldBigDecimalCompareTest.java | 27 import java.math.RoundingMode; 35 MathContext mc = new MathContext(34, RoundingMode.UP); in testAbsMathContextNeg() 38 mc = new MathContext(34, RoundingMode.DOWN); in testAbsMathContextNeg() 41 mc = new MathContext(34, RoundingMode.FLOOR); in testAbsMathContextNeg() 44 mc = new MathContext(34, RoundingMode.CEILING); in testAbsMathContextNeg() 47 mc = new MathContext(34, RoundingMode.UNNECESSARY); in testAbsMathContextNeg() 57 MathContext mc = new MathContext(37, RoundingMode.FLOOR); in testNegateMathContextPositive()
|
D | MathContextTest.java | 20 import java.math.RoundingMode; 25 for (RoundingMode rm : RoundingMode.values()) { in testConstructor() 33 MathContext mc = new MathContext("precision=" + p + " roundingMode=" + RoundingMode.UP); in testConstructor() 35 assertEquals(RoundingMode.UP, mc.getRoundingMode()); in testConstructor()
|
D | OldBigDecimalConvertTest.java | 26 import java.math.RoundingMode; 146 MathContext mc = new MathContext(iPresition, RoundingMode.UP); in test_ByteValueExactNeg() 158 MathContext mc = new MathContext(iPresition, RoundingMode.HALF_DOWN); in test_ByteValueExactCharZero() 168 MathContext mc = new MathContext(iPresition, RoundingMode.HALF_UP); in test_ByteValueExactStringZero() 258 MathContext mc = new MathContext(iPresition, RoundingMode.UP); in test_ByteValueNeg() 270 MathContext mc = new MathContext(iPresition, RoundingMode.HALF_UP); in test_ByteValueCharZero() 280 MathContext mc = new MathContext(iPresition, RoundingMode.HALF_UP); in test_ByteValueStringZero()
|
/libcore/ojluni/src/test/java/math/BigDecimal/ |
D | SquareRootTests.java | 93 List<RoundingMode> modes = in oneDigitTests() 94 List.of(RoundingMode.UP, RoundingMode.DOWN, in oneDigitTests() 95 RoundingMode.CEILING, RoundingMode.FLOOR, in oneDigitTests() 96 RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN); in oneDigitTests() 99 for (RoundingMode rm : modes) { in oneDigitTests() 122 List<RoundingMode> modes = in twoDigitTests() 123 List.of(RoundingMode.UP, RoundingMode.DOWN, in twoDigitTests() 124 RoundingMode.CEILING, RoundingMode.FLOOR, in twoDigitTests() 125 RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN); in twoDigitTests() 134 for (RoundingMode rm : modes) { in twoDigitTests() [all …]
|
D | IntegralDivisionTests.java | 139 new MathContext(i, RoundingMode.DOWN)); in divideContextTestPrecs() 224 MathContext mc = new MathContext(9,RoundingMode.DOWN); in dividetoIntegralValueScalingTests() 234 for(RoundingMode rm: RoundingMode.values()) in dividetoIntegralValueScalingTests() 252 for(RoundingMode rm: RoundingMode.values()) in dividetoIntegralValueScalingTests() 272 for(RoundingMode rm: RoundingMode.values()) in dividetoIntegralValueScalingTests() 294 for(RoundingMode rm: RoundingMode.values()) in dividetoIntegralValueScalingTests()
|
D | ZeroScalingTests.java | 43 static MathContext longEnough = new MathContext(50, RoundingMode.UNNECESSARY); 57 new MathContext(0, RoundingMode.UNNECESSARY), 58 new MathContext(100, RoundingMode.UNNECESSARY), 59 new MathContext(5, RoundingMode.UNNECESSARY), 60 new MathContext(4, RoundingMode.UNNECESSARY), 61 new MathContext(3, RoundingMode.UNNECESSARY), 62 new MathContext(2, RoundingMode.UNNECESSARY), 63 new MathContext(1, RoundingMode.UNNECESSARY), 365 Assert.assertEquals(total.setScale(0, RoundingMode.DOWN), in setScaleDoesNotMutateTest() 366 total.setScale(0, RoundingMode.DOWN)); in setScaleDoesNotMutateTest()
|
D | AddTests.java | 43 private static Set<RoundingMode> nonExactRoundingModes = 44 EnumSet.complementOf(EnumSet.of(RoundingMode.UNNECESSARY)); 90 mc = new MathContext(2, RoundingMode.DOWN); in addWithoutException() 224 for(RoundingMode rm : nonExactRoundingModes) { in roundAway0() 247 MathContext mc = new MathContext(1,RoundingMode.DOWN); in precisionConsistencyTest()
|
D | DivideTests.java | 133 RoundingMode.UNNECESSARY); in anotherDivide() 234 MathContext mc = new MathContext(3, RoundingMode.FLOOR); in trailingZeroTests() 306 … " scale " + scale + " rounding mode " + RoundingMode.valueOf(rm) + in scaledRoundedDivideTests() 331 BigDecimal quo = test[0].divide(test[1], RoundingMode.HALF_UP); in scaledRoundedDivideTests() 342 RoundingMode rounding = RoundingMode.UNNECESSARY; in divideByOneTests() 360 divide(one, RoundingMode.UNNECESSARY); in divideByOneTests() 369 divide(one, RoundingMode.DOWN); in divideByOneTests()
|
D | NegateTests.java | 79 negateTest(testCasesCeiling, new MathContext(1, RoundingMode.CEILING)); in negateTests() 86 negateTest(testCasesFloor, new MathContext(1, RoundingMode.FLOOR)); in negateTests()
|
/libcore/ojluni/src/main/java/java/math/ |
D | MathContext.java | 62 private static final RoundingMode DEFAULT_ROUNDINGMODE = RoundingMode.HALF_UP; 77 new MathContext(0, RoundingMode.HALF_UP); 87 new MathContext(7, RoundingMode.HALF_EVEN); 97 new MathContext(16, RoundingMode.HALF_EVEN); 107 new MathContext(34, RoundingMode.HALF_EVEN); 128 final RoundingMode roundingMode; 157 RoundingMode setRoundingMode) { in MathContext() 198 roundingMode = RoundingMode.valueOf(str); in MathContext() 236 public RoundingMode getRoundingMode() { in getRoundingMode()
|
D | RoundingMode.java | 105 public enum RoundingMode { enum 367 private RoundingMode(int oldMode) { in RoundingMode() method in RoundingMode 379 public static RoundingMode valueOf(int rm) { in valueOf()
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ |
D | DecimalFormatTest.java | 23 import java.math.RoundingMode; 2152 decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY); in test_formatToCharacterIterator_roundingUnnecessaryArithmeticException() 2167 decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY); in test_formatDouble_roundingUnnecessaryArithmeticException() 2183 decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY); in test_format_roundingUnnecessaryArithmeticException() 2200 decimalFormat.getRoundingMode(), RoundingMode.HALF_EVEN); in test_getRoundingMode() 2203 decimalFormat.setRoundingMode(RoundingMode.HALF_DOWN); in test_getRoundingMode() 2205 decimalFormat.getRoundingMode(), RoundingMode.HALF_DOWN); in test_getRoundingMode() 2227 decimalFormat.setRoundingMode(RoundingMode.HALF_DOWN); in test_format_withRoundingMode() 2239 decimalFormat.setRoundingMode(RoundingMode.CEILING); in test_format_withRoundingMode() 2248 decimalFormat.setRoundingMode(RoundingMode.DOWN); in test_format_withRoundingMode() [all …]
|
/libcore/ojluni/src/main/java/java/text/ |
D | DecimalFormat.java | 48 import java.math.RoundingMode; 4308 public RoundingMode getRoundingMode() { in getRoundingMode() 4313 private static int convertRoundingMode(RoundingMode rm) { in convertRoundingMode() 4345 public void setRoundingMode(RoundingMode roundingMode) { in setRoundingMode() 4408 new ObjectStreamField("roundingMode", RoundingMode.class), 4587 RoundingMode roundingMode = in readObject() 4588 (RoundingMode) fields.get("roundingMode", RoundingMode.HALF_EVEN); in readObject() 4890 private RoundingMode roundingMode = RoundingMode.HALF_EVEN;
|
/libcore/luni/src/test/java/libcore/java/text/ |
D | NumberFormatTest.java | 20 import java.math.RoundingMode; 106 nf.setRoundingMode(RoundingMode.UP); in testPercentageRounding() 109 nf.setRoundingMode(RoundingMode.DOWN); in testPercentageRounding()
|
/libcore/ojluni/annotations/sdk/nullability/java/text/ |
D | NumberFormat.annotated.java | 45 import java.math.RoundingMode; 126 @libcore.util.NonNull public java.math.RoundingMode getRoundingMode() { throw new RuntimeException(… in getRoundingMode() 128 public void setRoundingMode(@libcore.util.Nullable java.math.RoundingMode roundingMode) { throw new… in setRoundingMode()
|