Home
last modified time | relevance | path

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

12

/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/
DRoundingModeTest.java21 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 …]
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()
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()
DBigDecimalArithmeticTest.java23 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 …]
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()
DBigDecimalScaleOperationsTest.java245 BigDecimal result = aNumber.setScale(newScale, RoundingMode.HALF_EVEN); in testSetScaleIntRoundingMode()
/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/luni/src/main/java/java/math/
DMathContext.java37 public static final MathContext DECIMAL128 = new MathContext(34, RoundingMode.HALF_EVEN);
44 public static final MathContext DECIMAL32 = new MathContext(7, RoundingMode.HALF_EVEN);
51 public static final MathContext DECIMAL64 = new MathContext(16, RoundingMode.HALF_EVEN);
57 public static final MathContext UNLIMITED = new MathContext(0, RoundingMode.HALF_UP);
69 private final RoundingMode roundingMode;
83 this(precision, RoundingMode.HALF_UP); in MathContext()
101 public MathContext(int precision, RoundingMode roundingMode) { in MathContext()
138 this.roundingMode = RoundingMode.valueOf(s.substring(roundingModeStart)); in MathContext()
185 public RoundingMode getRoundingMode() { in getRoundingMode()
DRoundingMode.java24 public enum RoundingMode { enum
88 RoundingMode(int rm) { in RoundingMode() method in RoundingMode
100 public static RoundingMode valueOf(int mode) { in valueOf()
DBigDecimal.java998 return divide(divisor, scale, RoundingMode.valueOf(roundingMode)); in divide()
1024 public BigDecimal divide(BigDecimal divisor, int scale, RoundingMode roundingMode) { in divide()
1083 …tegers(BigInteger scaledDividend, BigInteger scaledDivisor, int scale, RoundingMode roundingMode) { in divideBigIntegers()
1119 …videPrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { in dividePrimitiveLongs()
1158 return divide(divisor, scale, RoundingMode.valueOf(roundingMode)); in divide()
1181 public BigDecimal divide(BigDecimal divisor, RoundingMode roundingMode) { in divide()
1877 public BigDecimal setScale(int newScale, RoundingMode roundingMode) { in setScale()
1925 return setScale(newScale, RoundingMode.valueOf(roundingMode)); in setScale()
1945 return setScale(newScale, RoundingMode.UNNECESSARY); in setScale()
2812 private static int roundingBehavior(int parityBit, int fraction, RoundingMode roundingMode) { in roundingBehavior()
/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.java49 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()
/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/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.java81 import java.math.RoundingMode;
976 return create(toSeconds().divide(BigDecimal.valueOf(divisor), RoundingMode.DOWN)); in dividedBy()

12