/libcore/luni/src/test/java/libcore/java/math/ |
D | MathContextTest.java | 19 import java.math.MathContext; 26 MathContext mc = new MathContext("precision=1 roundingMode=" + rm); in testConstructor() 33 MathContext mc = new MathContext("precision=" + p + " roundingMode=" + RoundingMode.UP); in testConstructor() 39 new MathContext("precision=1 roundingMode=UP"); in testConstructor() 41 new MathContext("Precision=1 roundingMode=UP"); in testConstructor() 46 new MathContext("precision=1 RoundingMode=UP"); in testConstructor() 53 new MathContext("precision=1 roundingMode=up"); in testConstructor() 60 new MathContext("precision=1roundingMode=UP"); in testConstructor() 65 new MathContext("precision=1 roundingMode=UP"); in testConstructor() 70 new MathContext("precision=1\troundingMode=UP"); in testConstructor() [all …]
|
D | OldBigDecimalConstructorsTest.java | 25 import java.math.MathContext; 39 MathContext mc = new MathContext(precision, rm); 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 | OldBigDecimalCompareTest.java | 26 import java.math.MathContext; 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 | OldBigDecimalArithmeticTest.java | 22 import java.math.MathContext; 29 MathContext mc; in testAddMathContextNonTrivial() 32 mc = new MathContext(17, RoundingMode.FLOOR); in testAddMathContextNonTrivial() 44 mc = new MathContext(33, RoundingMode.UNNECESSARY); in testAddMathContextNonTrivial() 54 MathContext mc; in testSubtractMathContextNonTrivial() 57 mc = new MathContext(17, RoundingMode.FLOOR); in testSubtractMathContextNonTrivial() 67 mc = new MathContext(33, RoundingMode.UNNECESSARY); in testSubtractMathContextNonTrivial() 77 MathContext mc; in testMultiplyMathContextNonTrivial() 80 mc = new MathContext(17, RoundingMode.FLOOR); in testMultiplyMathContextNonTrivial() 118 MathContext mc = new MathContext(5, RoundingMode.HALF_UP); in testPowMathContext() [all …]
|
D | OldBigDecimalConvertTest.java | 25 import java.math.MathContext; 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()
|
D | BigDecimalTest.java | 21 import java.math.MathContext; 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()
|
/libcore/ojluni/src/main/java/java/math/ |
D | MathContext.java | 56 public final class MathContext implements Serializable { class 76 public static final MathContext UNLIMITED = 77 new MathContext(0, RoundingMode.HALF_UP); 86 public static final MathContext DECIMAL32 = 87 new MathContext(7, RoundingMode.HALF_EVEN); 96 public static final MathContext DECIMAL64 = 97 new MathContext(16, RoundingMode.HALF_EVEN); 106 public static final MathContext DECIMAL128 = 107 new MathContext(34, RoundingMode.HALF_EVEN); 141 public MathContext(int setPrecision) { in MathContext() method in MathContext [all …]
|
D | BigDecimal.java | 480 this(in,offset,len,MathContext.UNLIMITED); in BigDecimal() 504 public BigDecimal(char[] in, int offset, int len, MathContext mc) { in BigDecimal() 803 public BigDecimal(char[] in, MathContext mc) { in BigDecimal() 924 public BigDecimal(String val, MathContext mc) { in BigDecimal() 973 this(val,MathContext.UNLIMITED); in BigDecimal() 992 public BigDecimal(double val, MathContext mc) { in BigDecimal() 1106 public BigDecimal(BigInteger val, MathContext mc) { in BigDecimal() 1139 public BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) { in BigDecimal() 1201 public BigDecimal(int val, MathContext mc) { in BigDecimal() 1244 public BigDecimal(long val, MathContext mc) { in BigDecimal() [all …]
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/ |
D | MathContextTest.java | 21 import java.math.MathContext; 32 MathContext mcIntRm6hd = new MathContext(6, RoundingMode.HALF_DOWN); in test_MathContextConstruction() 33 MathContext mcStr6hd = new MathContext("precision=6 roundingMode=HALF_DOWN"); in test_MathContextConstruction() 34 MathContext mcInt6 = new MathContext(6); in test_MathContextConstruction() 35 MathContext mcInt134 = new MathContext(134); in test_MathContextConstruction()
|
D | BigDecimalConstructorsTest.java | 25 import java.math.MathContext; 103 MathContext mc = new MathContext(precision, rm); in testConstrBigIntegerMathContext() 120 MathContext mc = new MathContext(precision, rm); in testConstrBigIntegerScaleMathContext() 177 MathContext mc = new MathContext(precision, rm); in testConstrCharIntIntMathContext() 186 new BigDecimal(new char[] {}, 0, 0, MathContext.DECIMAL32); in testConstrCharIntIntMathContext() 201 MathContext mc = new MathContext(precision, rm); in testConstrCharIntIntMathContextException1() 218 MathContext mc = new MathContext(precision, rm); in testConstrCharIntIntMathContextException2() 232 new BigDecimal(new char[] {}, MathContext.DECIMAL32); in testConstrCharMathContext() 293 MathContext mc = new MathContext(precision, rm); in testConstrDoubleMathContext() 356 MathContext mc = new MathContext(precision, rm); in testConstrIntMathContext() [all …]
|
D | BigDecimalArithmeticTest.java | 22 import java.math.MathContext; 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 | BigDecimalCompareTest.java | 25 import java.math.MathContext; 64 MathContext mc = new MathContext(precision, rm); in testAbsMathContextNeg() 80 MathContext mc = new MathContext(precision, rm); in testAbsMathContextPos() 375 MathContext mc = new MathContext(precision, rm); in testPlusMathContextPositive() 405 MathContext mc = new MathContext(precision, rm); in testPlusMathContextNegative() 435 MathContext mc = new MathContext(precision, rm); in testNegateMathContextPositive() 465 MathContext mc = new MathContext(precision, rm); in testNegateMathContextNegative()
|
D | BigDecimalTest.java | 26 import java.math.MathContext; 925 MathContext mcIntRm = new MathContext(precision, rm); in testMathContextConstruction() 926 MathContext mcStr = new MathContext("precision=6 roundingMode=HALF_DOWN"); in testMathContextConstruction() 927 MathContext mcInt = new MathContext(precision); in testMathContextConstruction()
|
/libcore/ojluni/src/test/java/math/BigDecimal/ |
D | RangeTests.java | 36 import java.math.MathContext; 155 private static void testRoundingFromBigInteger(BigInteger bi, int scale, MathContext mc) { in testRoundingFromBigInteger() 170 7, MathContext.DECIMAL64); in roundingConstructorTest() 173 0, MathContext.DECIMAL64); in roundingConstructorTest() 176 -7, MathContext.DECIMAL64); in roundingConstructorTest() 179 7, MathContext.DECIMAL128); in roundingConstructorTest() 182 177, MathContext.DECIMAL128); in roundingConstructorTest() 185 177, MathContext.DECIMAL32); in roundingConstructorTest() 188 177, MathContext.UNLIMITED); in roundingConstructorTest() 191 0, MathContext.UNLIMITED); in roundingConstructorTest() [all …]
|
D | SquareRootTests.java | 57 BigDecimal result = input.sqrt(MathContext.DECIMAL64); in negativeTests() 72 compare(BigDecimal.valueOf(0L, i).sqrt(MathContext.UNLIMITED), in zeroTests() 75 compare(BigDecimal.valueOf(0L, i).sqrt(MathContext.DECIMAL64), in zeroTests() 101 MathContext mc = new MathContext(i, rm); in oneDigitTests() 135 MathContext mc = new MathContext(precision, rm); in twoDigitTests() 145 private static void compareSqrtImplementations(BigDecimal bd, MathContext mc) { in compareSqrtImplementations() 156 MathContext oneDigitExactly = new MathContext(1, RoundingMode.UNNECESSARY); in evenPowersOfTenTests() 166 result = testValue.sqrt(MathContext.DECIMAL64), in evenPowersOfTenTests() 201 MathContext mc = new MathContext(precision, mode); in squareRootTwoTests() 235 MathContext mc = new MathContext(precision, rm); in lowPrecisionPerfectSquares() [all …]
|
D | ZeroScalingTests.java | 43 static MathContext longEnough = new MathContext(50, RoundingMode.UNNECESSARY); 56 static MathContext[] contexts = { 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), 79 result = zero1.add(zero2, MathContext.UNLIMITED); in addTests() [all …]
|
D | NegateTests.java | 40 static BigDecimal negateThenRound(BigDecimal bd, MathContext mc) { in negateThenRound() 45 static BigDecimal absThenRound(BigDecimal bd, MathContext mc) { in absThenRound() 50 static void negateTest(BigDecimal[][] testCases, MathContext mc) { in negateTest() 79 negateTest(testCasesCeiling, new MathContext(1, RoundingMode.CEILING)); in negateTests() 86 negateTest(testCasesFloor, new MathContext(1, RoundingMode.FLOOR)); in negateTests()
|
D | IntegralDivisionTests.java | 139 new MathContext(i, RoundingMode.DOWN)); in divideContextTestPrecs() 172 MathContext mc) { in divideContextTests() 186 MathContext mc) { in divideContextTest() 224 MathContext mc = new MathContext(9,RoundingMode.DOWN); in dividetoIntegralValueScalingTests() 236 divideContextTests(dividend, divisor, expected, new MathContext(precision, rm)); in dividetoIntegralValueScalingTests() 256 new MathContext(precisions1[i], rm)); in dividetoIntegralValueScalingTests() 276 new MathContext(precisions2[i], rm)); in dividetoIntegralValueScalingTests() 298 new MathContext(precisions3[i], rm)); in dividetoIntegralValueScalingTests()
|
D | AddTests.java | 88 private static void addWithoutException(BigDecimal b1, BigDecimal b2, MathContext mc) { in addWithoutException() 90 mc = new MathContext(2, RoundingMode.DOWN); in addWithoutException() 225 MathContext mc = new MathContext(precision, rm); in roundAway0() 247 MathContext mc = new MathContext(1,RoundingMode.DOWN); in precisionConsistencyTest()
|
D | RoundingTests.java | 43 MathContext mc = new MathContext(1); in roundingTests()
|
D | DivideTests.java | 130 MathContext mc = new MathContext(dividend.precision() + in anotherDivide() 234 MathContext mc = new MathContext(3, RoundingMode.FLOOR); in trailingZeroTests()
|
D | ConstructorUnscaledValue.java | 42 new BigDecimal(tbi, 3, MathContext.DECIMAL32), in main()
|
D | DivideMcTests.java | 37 import java.math.MathContext; 5767 BigDecimal res1 = v1.divide(v2, MathContext.DECIMAL64); in mcDivideTests() 5778 BigDecimal res1 = v1.divide(v2, new MathContext(mpc, RoundingMode.HALF_EVEN)); in mcDivideTests() 5779 …BigDecimal res2 = v1.divide(v2, new MathContext(128, RoundingMode.HALF_EVEN)).round(new MathContex… in mcDivideTests()
|
/libcore/ojluni/src/main/java/java/text/ |
D | DecimalFormat.java | 56 import android.icu.math.MathContext; 4316 return MathContext.ROUND_UP; in convertRoundingMode() 4318 return MathContext.ROUND_DOWN; in convertRoundingMode() 4320 return MathContext.ROUND_CEILING; in convertRoundingMode() 4322 return MathContext.ROUND_FLOOR; in convertRoundingMode() 4324 return MathContext.ROUND_HALF_UP; in convertRoundingMode() 4326 return MathContext.ROUND_HALF_DOWN; in convertRoundingMode() 4328 return MathContext.ROUND_HALF_EVEN; in convertRoundingMode() 4330 return MathContext.ROUND_UNNECESSARY; in convertRoundingMode()
|
/libcore/ojluni/src/main/java/java/util/ |
D | Formatter.java | 49 import java.math.MathContext; 3902 MathContext mc = new MathContext(compPrec); in print() 3956 new MathContext(compPrec)); in print() 3989 value = value.round(new MathContext(prec)); in print()
|