Home
last modified time | relevance | path

Searched refs:RoundingMode (Results 1 – 25 of 25) sorted by relevance

/libcore/luni/src/test/java/libcore/java/math/
DBigDecimalTest.java22 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 …]
DOldBigDecimalConstructorsTest.java26 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 …]
DOldBigDecimalTest.java22 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 …]
DOldBigDecimalArithmeticTest.java23 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 …]
DOldBigDecimalCompareTest.java27 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()
DMathContextTest.java20 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()
DOldBigDecimalConvertTest.java26 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/main/java/java/math/
DMathContext.java62 private static final RoundingMode DEFAULT_ROUNDINGMODE = RoundingMode.HALF_UP;
79 new MathContext(0, RoundingMode.HALF_UP);
88 new MathContext(7, RoundingMode.HALF_EVEN);
97 new MathContext(16, RoundingMode.HALF_EVEN);
106 new MathContext(34, RoundingMode.HALF_EVEN);
127 final RoundingMode roundingMode;
156 RoundingMode setRoundingMode) { in MathContext()
197 roundingMode = RoundingMode.valueOf(str); in MathContext()
235 public RoundingMode getRoundingMode() { in getRoundingMode()
DRoundingMode.java93 public enum RoundingMode { enum
313 private RoundingMode(int oldMode) { in RoundingMode() method in RoundingMode
325 public static RoundingMode valueOf(int rm) { in valueOf()
DBigDecimal.java1593 public BigDecimal divide(BigDecimal divisor, int scale, RoundingMode roundingMode) { in divide()
1643 public BigDecimal divide(BigDecimal divisor, RoundingMode roundingMode) { in divide()
1688 RoundingMode.UNNECESSARY); in divide()
1796 RoundingMode.DOWN)); in divideToIntegralValue()
1798 quotient = quotient.setScale(0, RoundingMode.DOWN); in divideToIntegralValue()
1845 BigDecimal result = this.divide(divisor, new MathContext(mc.precision, RoundingMode.DOWN)); in divideToIntegralValue()
1865 result = result.setScale(0, RoundingMode.DOWN); in divideToIntegralValue()
2388 public BigDecimal setScale(int newScale, RoundingMode roundingMode) { in setScale()
4195 … roundingMode <= ROUND_HALF_EVEN: "Unexpected rounding mode" + RoundingMode.valueOf(roundingMode); in commonNeedIncrement()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/
DMathContextTest.java22 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()
DBigDecimalConstructorsTest.java26 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()
DBigDecimalCompareTest.java26 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()
DBigDecimalTest.java27 import java.math.RoundingMode;
924 RoundingMode rm = RoundingMode.HALF_DOWN; in testMathContextConstruction()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/
DDecimalFormatTest.java23 import java.math.RoundingMode;
2136 decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY); in test_formatToCharacterIterator_roundingUnnecessaryArithmeticException()
2151 decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY); in test_formatDouble_roundingUnnecessaryArithmeticException()
2167 decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY); in test_format_roundingUnnecessaryArithmeticException()
2184 decimalFormat.getRoundingMode(), RoundingMode.HALF_EVEN); in test_getRoundingMode()
2187 decimalFormat.setRoundingMode(RoundingMode.HALF_DOWN); in test_getRoundingMode()
2189 decimalFormat.getRoundingMode(), RoundingMode.HALF_DOWN); in test_getRoundingMode()
2211 decimalFormat.setRoundingMode(RoundingMode.HALF_DOWN); in test_format_withRoundingMode()
2223 decimalFormat.setRoundingMode(RoundingMode.CEILING); in test_format_withRoundingMode()
2232 decimalFormat.setRoundingMode(RoundingMode.DOWN); in test_format_withRoundingMode()
[all …]
DNumberFormatTest.java19 import java.math.RoundingMode;
291 ((NumberFormat) choiceFormat).setRoundingMode(RoundingMode.CEILING); in test_setRoundingMode_Normal()
/libcore/ojluni/src/main/java/java/text/
DDecimalFormat.java48 import java.math.RoundingMode;
4123 public RoundingMode getRoundingMode() { in getRoundingMode()
4128 private static int convertRoundingMode(RoundingMode rm) { in convertRoundingMode()
4160 public void setRoundingMode(RoundingMode roundingMode) { in setRoundingMode()
4223 new ObjectStreamField("roundingMode", RoundingMode.class),
4395 RoundingMode roundingMode = in readObject()
4396 (RoundingMode) fields.get("roundingMode", RoundingMode.HALF_EVEN); in readObject()
4697 private RoundingMode roundingMode = RoundingMode.HALF_EVEN;
DNumberFormat.java47 import java.math.RoundingMode;
803 public RoundingMode getRoundingMode() { in getRoundingMode()
821 public void setRoundingMode(RoundingMode roundingMode) { in setRoundingMode()
/libcore/luni/src/test/java/libcore/java/text/
DNumberFormatTest.java20 import java.math.RoundingMode;
106 nf.setRoundingMode(RoundingMode.UP); in testPercentageRounding()
109 nf.setRoundingMode(RoundingMode.DOWN); in testPercentageRounding()
DDecimalFormatTest.java22 import java.math.RoundingMode;
45 df.setRoundingMode(RoundingMode.HALF_UP); in test_setMaximumFractionDigitsAffectsRoundingMode()
/libcore/ojluni/annotations/sdk/nullability/java/text/
DNumberFormat.annotated.java45 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()
/libcore/ojluni/src/test/java/lang/Math/
DDivModTests.java26 import java.math.RoundingMode;
228 BigDecimal resultD = xD.divide(yD, RoundingMode.FLOOR); in testLongFloorMod()
333 BigDecimal resultD = xD.divide(yD, RoundingMode.FLOOR); in testLongIntFloorMod()
/libcore/ojluni/annotations/hiddenapi/java/text/
DNumberFormat.java196 public java.math.RoundingMode getRoundingMode() { in getRoundingMode()
200 public void setRoundingMode(java.math.RoundingMode roundingMode) { in setRoundingMode()
/libcore/ojluni/src/main/java/java/time/
DDuration.java83 import java.math.RoundingMode;
978 return create(toBigDecimalSeconds().divide(BigDecimal.valueOf(divisor), RoundingMode.DOWN)); in dividedBy()
/libcore/
Dopenjdk_java_files.bp267 "ojluni/src/main/java/java/math/RoundingMode.java",