Home
last modified time | relevance | path

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

123

/libcore/ojluni/src/test/java/math/BigDecimal/
DZeroScalingTests.java72 Math.max(zero1.scale(), zero2.scale())); in addTests()
76 expected.scale() + "; got " + in addTests()
77 result.scale() + "."); in addTests()
82 expected.scale() + "; got " + in addTests()
83 result.scale() + "."); in addTests()
88 expected.scale() + "; got " + in addTests()
89 result.scale() + "."); in addTests()
96 if (Math.abs((long)zero.scale()) < 100 ) { in addTests()
98 int preferredScale = Math.max(zero.scale(), element.scale()); in addTests()
108 Assert.assertFalse(result.scale() != preferredScale || in addTests()
[all …]
DIntegralDivisionTests.java65 "dividend = " + testCase[0] + " scale = " + testCase[0].scale() + in dividetoIntegralValueTests()
66 " divisor = " + testCase[1] + " scale = " + testCase[1].scale() + in dividetoIntegralValueTests()
67 " quotient = " + quotient + " scale = " + quotient.scale() + in dividetoIntegralValueTests()
68 " expected = " + testCase[2] + " scale = " + testCase[2].scale()); in dividetoIntegralValueTests()
143 " dividend = " + dividend + " scale = " + dividend.scale() + in divideContextTestPrecs()
144 " divisor = " + divisor + " scale = " + divisor.scale() + in divideContextTestPrecs()
145 " expected = " + quotient + " scale = " + quotient.scale()); in divideContextTestPrecs()
151 " dividend = " + dividend + " scale = " + dividend.scale() + in divideContextTestPrecs()
152 " divisor = " + divisor + " scale = " + divisor.scale() + in divideContextTestPrecs()
153 " quotient = " + result + " scale = " + result.scale() + in divideContextTestPrecs()
[all …]
DSquareRootTests.java158 for (int scale = -100; scale <= 100; scale++) { in evenPowersOfTenTests()
159 BigDecimal testValue = BigDecimal.valueOf(1, 2*scale); in evenPowersOfTenTests()
160 BigDecimal expectedNumericalResult = BigDecimal.valueOf(1, scale); in evenPowersOfTenTests()
230 for (int scale = 0; scale <= 4; scale++) { in lowPrecisionPerfectSquares()
231 BigDecimal scaledSquare = square.setScale(scale, RoundingMode.UNNECESSARY); in lowPrecisionPerfectSquares()
232 int expectedScale = scale/2; in lowPrecisionPerfectSquares()
240 int computedScale = computedRoot.scale(); in lowPrecisionPerfectSquares()
460 int preferredScale = bd.scale()/2;
467 int strippedScale = stripped.scale();
473 if (result.scale() != preferredScale) {
[all …]
DDivideTests.java75 … BigInteger divisorIntvalue = divisor.scaleByPowerOfTen(divisor.scale()).toBigInteger().abs(); in anotherDivide()
76 … BigInteger dividendIntvalue = dividend.scaleByPowerOfTen(dividend.scale()).toBigInteger().abs(); in anotherDivide()
300 int scale = tc[2].scale(); in scaledRoundedDivideTests() local
303 BigDecimal quotient = tc[0].divide(tc[1], scale, rm); in scaledRoundedDivideTests()
306 … " scale " + scale + " rounding mode " + RoundingMode.valueOf(rm) + in scaledRoundedDivideTests()
355 int scale = (int)uas[1]; in divideByOneTests() local
359 noRound = BigDecimal.valueOf(unscaled, scale). in divideByOneTests()
363 + " and scale " + scale + " without rounding"); in divideByOneTests()
368 roundDown = BigDecimal.valueOf(unscaled, scale). in divideByOneTests()
372 + " and scale " + scale + " with rounding down"); in divideByOneTests()
[all …]
DStringConstructor.java87 int scale = random.nextInt(decimalLength); in testRoundtrip() local
88 BigDecimal bd = new BigDecimal(bi, scale); in testRoundtrip()
91 Assert.assertEquals(bd, bdDoppel, "bd string: scale: " + bd.scale() + in testRoundtrip()
92 "\t" + bdString + "\nbd doppel: scale: " + bdDoppel.scale() + in testRoundtrip()
DRangeTests.java155 private static void testRoundingFromBigInteger(BigInteger bi, int scale, MathContext mc) { in testRoundingFromBigInteger() argument
156 BigDecimal bd1 = new BigDecimal(bi,scale, mc); in testRoundingFromBigInteger()
157 BigDecimal bd2 = (new BigDecimal(bi,scale)).round(mc); in testRoundingFromBigInteger()
160 bi + "; scale == " + scale + "; result == " + in testRoundingFromBigInteger()
/libcore/ojluni/src/main/java/java/math/
DBigDecimal.java322 private final int scale; // Note: this may have any value, so field in BigDecimal
453 BigDecimal(BigInteger intVal, long val, int scale, int prec) { in BigDecimal() argument
454 this.scale = scale; in BigDecimal()
705 this.scale = scl; in BigDecimal()
1012 this.scale = 0; in BigDecimal()
1070 this.scale = scl; in BigDecimal()
1091 scale = 0; in BigDecimal()
1119 public BigDecimal(BigInteger unscaledVal, int scale) { in BigDecimal() argument
1123 this.scale = scale; in BigDecimal()
1139 public BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) { in BigDecimal() argument
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/
DBigDecimalTest.java42 && big.scale() == 0); in test_ConstructorLjava_math_BigInteger()
52 && big.scale() == 5); in test_ConstructorLjava_math_BigIntegerI()
74 && big.scale() == 0); in test_ConstructorD()
87 big.scale() == 0); in test_ConstructorD()
97 && big.scale() == 14); in test_ConstructorLjava_lang_String()
101 && big.scale() == 0); in test_ConstructorLjava_lang_String()
105 && big.scale() == 0); in test_ConstructorLjava_lang_String()
190 && sum.scale() == 3); in test_addLjava_math_BigDecimal()
223 && divd3.scale() == divd1.scale()); in test_divideLjava_math_BigDecimalI()
231 && divd3.scale() == 2); in test_divideLjava_math_BigDecimalI()
[all …]
DBigDecimalConstructorsTest.java73 assertEquals("incorrect scale", 0, aNumber.scale()); in testConstrBI()
92 assertEquals("incorrect scale", aScale, aNumber.scale()); in testConstrBIScale()
108 assertEquals("incorrect scale", resScale, result.scale()); in testConstrBigIntegerMathContext()
125 assertEquals("incorrect scale", resScale, result.scale()); in testConstrBigIntegerScaleMathContext()
137 assertEquals("incorrect scale", resScale, result.scale()); in testConstrChar()
158 assertEquals("incorrect scale", resScale, result.scale()); in testConstrCharIntInt()
182 assertEquals("incorrect scale", resScale, result.scale()); in testConstrCharIntIntMathContext()
283 assertEquals("incorrect scale", aScale, aNumber.scale()); in testConstrDouble()
298 assertEquals("incorrect scale", resScale, result.scale()); in testConstrDoubleMathContext()
310 assertEquals("incorrect scale", aScale, aNumber.scale()); in testConstrDouble01()
[all …]
DBigDecimalScaleOperationsTest.java38 assertTrue("incorrect scale", aNumber.scale() == cScale); in testScaleDefault()
49 assertTrue("incorrect scale", aNumber.scale() == cScale); in testScaleNeg()
60 assertTrue("incorrect scale", aNumber.scale() == cScale); in testScalePos()
71 assertTrue("incorrect scale", aNumber.scale() == cScale); in testScaleZero()
94 assertTrue("incorrect scale", bNumber.scale() == newScale); in testSetScaleGreater()
106 assertTrue("incorrect scale", bNumber.scale() == newScale); in testSetScaleLess()
135 assertTrue("incorrect scale", bNumber.scale() == newScale); in testSetScaleSame()
149 assertTrue("incorrect scale", bNumber.scale() == newScale); in testSetScaleRoundUp()
163 assertTrue("incorrect scale", bNumber.scale() == newScale); in testSetScaleRoundDown()
177 assertTrue("incorrect scale", bNumber.scale() == newScale); in testSetScaleRoundCeiling()
[all …]
DBigDecimalArithmeticTest.java46 assertEquals("incorrect scale", cScale, result.scale()); in testAddEqualScalePosPos()
64 assertEquals("incorrect scale", cScale, result.scale()); in testAddMathContextEqualScalePosPos()
81 assertEquals("incorrect scale", cScale, result.scale()); in testAddEqualScaleNegNeg()
99 assertEquals("incorrect scale", cScale, result.scale()); in testAddMathContextEqualScaleNegNeg()
116 assertEquals("incorrect scale", cScale, result.scale()); in testAddDiffScalePosNeg()
134 assertEquals("incorrect scale", cScale, result.scale()); in testAddMathContextDiffScalePosNeg()
151 assertEquals("incorrect scale", cScale, result.scale()); in testAddDiffScaleNegPos()
168 assertEquals("incorrect scale", cScale, result.scale()); in testAddDiffScaleZeroZero()
185 assertEquals("incorrect scale", cScale, result.scale()); in testSubtractEqualScalePosPos()
203 assertEquals("incorrect scale", cScale, result.scale()); in testSubtractMathContextEqualScalePosPos()
[all …]
DBigDecimalConvertTest.java208 assertEquals("incorrect scale", resScale, result.scale()); in testScaleByPowerOfTen1()
222 assertEquals("incorrect scale", resScale, result.scale()); in testScaleByPowerOfTen2()
470 int scale = 12; in testValueOfNegScalePos() local
471 BigDecimal aNumber = BigDecimal.valueOf(a, scale); in testValueOfNegScalePos()
481 int scale = -12; in testValueOfNegScaleNeg() local
482 BigDecimal aNumber = BigDecimal.valueOf(a, scale); in testValueOfNegScaleNeg()
492 int scale = 12; in testValueOfPosScalePos() local
493 BigDecimal aNumber = BigDecimal.valueOf(a, scale); in testValueOfPosScalePos()
503 int scale = -12; in testValueOfPosScaleNeg() local
504 BigDecimal aNumber = BigDecimal.valueOf(a, scale); in testValueOfPosScaleNeg()
[all …]
DBigDecimalCompareTest.java69 assertEquals("incorrect scale", resScale, res.scale()); in testAbsMathContextNeg()
85 assertEquals("incorrect scale", resScale, res.scale()); in testAbsMathContextPos()
381 assertEquals("incorrect scale", cScale, res.scale()); in testPlusMathContextPositive()
411 assertEquals("incorrect scale", cScale, res.scale()); in testPlusMathContextNegative()
441 assertEquals("incorrect scale", cScale, res.scale()); in testNegateMathContextPositive()
471 assertEquals("incorrect scale", cScale, res.scale()); in testNegateMathContextNegative()
/libcore/luni/src/test/java/libcore/java/math/
DOldBigDecimalTest.java76 setScale2.scale() == 4); in test_setScaleILjava_math_RoundingMode()
83 setScale2.scale() == 17); in test_setScaleILjava_math_RoundingMode()
93 setScale2.toString().equals("1234.6") && setScale2.scale() == 1); in test_setScaleILjava_math_RoundingMode()
99 && setScale2.scale() == 1); in test_setScaleILjava_math_RoundingMode()
106 && setScale2.scale() == 1); in test_setScaleILjava_math_RoundingMode()
111 setScale2.toString().equals("1234.5") && setScale2.scale() == 1); in test_setScaleILjava_math_RoundingMode()
117 setScale2.toString().equals("1234.5") && setScale2.scale() == 1); in test_setScaleILjava_math_RoundingMode()
122 && setScale2.scale() == 1); in test_setScaleILjava_math_RoundingMode()
129 && setScale2.scale() == 3); in test_setScaleILjava_math_RoundingMode()
134 setScale2.toString().equals("123.4") && setScale2.scale() == 1); in test_setScaleILjava_math_RoundingMode()
[all …]
DOldBigDecimalScaleOperationsTest.java32 assertEquals("incorrect scale", 24, res.scale()); in testMovePointRightEx()
35 assertEquals("incorrect scale", 84, res.scale()); in testMovePointRightEx()
57 assertEquals("incorrect scale", 24, res.scale()); in testScaleByPowerOfTenEx()
60 assertEquals("incorrect scale", 84, res.scale()); in testScaleByPowerOfTenEx()
63 assertEquals("incorrect scale", -16, res.scale()); in testScaleByPowerOfTenEx()
DOldBigDecimalConstructorsTest.java44 assertEquals("incorrect scale", resScale, result.scale()); in testConstrBigIntegerMathContext()
125 assertEquals("incorrect scale", resScale, result.scale()); in testConstrBigIntegerScaleMathContext()
288 assertEquals("incorrect scale", resScale, result.scale()); in testConstrCharIntIntMathContext()
441 assertEquals("incorrect scale", resScale, result.scale()); in testConstrDoubleMathContext()
579 assertEquals("incorrect scale", resScale, result.scale()); in testConstrLongMathContext()
668 assertEquals("incorrect scale", resScale, result.scale()); in testConstrStringMathContext()
723 && big.scale() == 0); in test_Constructor_java_math_BigInteger_int()
729 && big2.scale() == 5); in test_Constructor_java_math_BigInteger_int()
750 && big.scale() == 0); in test_Constructor_Double()
759 assertTrue("the double representation of -0.0 bigDecimal is not correct", big.scale() == 0); in test_Constructor_Double()
[all …]
DOldBigDecimalConvertTest.java417 assertTrue("incorrect value", result.scale() == 0); in test_stripTrailingZerosZeros()
422 assertTrue("incorrect value", result.scale() == 0); in test_stripTrailingZerosZeros()
427 assertTrue("incorrect value", result.scale() == 0); in test_stripTrailingZerosZeros()
437 assertTrue("incorrect value", bdResult.scale() == iScale); in test_stripTrailingZeros()
445 assertTrue("incorrect value", bdResult.scale() == iScale); in test_stripTrailingZeros()
DBigDecimalTest.java84 assertEquals(21, a.scale()); in testPrecisionFromString()
85 assertEquals(21, b.scale()); in testPrecisionFromString()
127 private static void checkDivide(String expected, long n, long d, int scale, RoundingMode rm) { in checkDivide() argument
128 assertEquals(String.format(Locale.US, "%d/%d [%d, %s]", n, d, scale, rm.name()), in checkDivide()
130 new BigDecimal(n).divide(new BigDecimal(d), scale, rm)); in checkDivide()
/libcore/ojluni/src/main/java/java/util/concurrent/
DTimeUnit.java123 private final long scale; field in TimeUnit
133 this.scale = s; in TimeUnit()
191 default: return cvt(sourceDuration, scale, sourceUnit.scale); in convert()
229 else if ((s = scale) < SECOND_SCALE) in convert()
253 if ((s = scale) == NANO_SCALE) in toNanos()
273 if ((s = scale) <= MICRO_SCALE) in toMicros()
293 if ((s = scale) <= MILLI_SCALE) in toMillis()
313 if ((s = scale) <= SECOND_SCALE) in toSeconds()
333 return cvt(duration, MINUTE_SCALE, scale); in toMinutes()
346 return cvt(duration, HOUR_SCALE, scale); in toHours()
[all …]
/libcore/luni/src/test/java/libcore/libcore/io/
DMemoryTest.java34 int scale = Integer.BYTES; in testSetIntArray() local
36 byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, scale * values.length + 1); in testSetIntArray()
55 Memory.pokeIntArray(ptr + i * scale, values, i, 1, true); in testSetIntArray()
75 int scale = Long.BYTES; in testSetLongArray() local
77 byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, scale * values.length + 1); in testSetLongArray()
96 Memory.pokeLongArray(ptr + i * scale, values, i, 1, true); in testSetLongArray()
113 int scale = Short.BYTES; in testSetShortArray() local
115 byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, scale * values.length + 1); in testSetShortArray()
134 Memory.pokeShortArray(ptr + i * scale, values, i, 1, true); in testSetShortArray()
/libcore/luni/src/main/java/javax/xml/datatype/
DDuration.java938 int scale = bd.scale(); in toString() local
940 if (scale == 0) { in toString()
946 int insertionPoint = intString.length() - scale; in toString()
/libcore/ojluni/src/main/java/java/util/
DFormatter.java3890 int scale = value.scale(); in print() local
3904 = new BigDecimal(value.unscaledValue(), scale, mc); in print()
3907 = new BigDecimalLayout(v.unscaledValue(), v.scale(), in print()
3944 int scale = value.scale(); in print() local
3946 if (scale > prec) { in print()
3949 if (compPrec <= scale) { in print()
3953 compPrec -= (scale - prec); in print()
3955 scale, in print()
3961 value.scale(), in print()
3965 int nzeros = (bdl.scale() < prec ? prec - bdl.scale() : 0); in print()
[all …]
/libcore/ojluni/src/main/java/java/nio/file/attribute/
DFileTime.java208 private static long scale(long d, long m, long over) { in scale() method in FileTime
236 secs = scale(value, SECONDS_PER_DAY, in toInstant()
240 secs = scale(value, SECONDS_PER_HOUR, in toInstant()
244 secs = scale(value, SECONDS_PER_MINUTE, in toInstant()
/libcore/luni/src/test/java/libcore/java/sql/
DOldResultSetMetaDataTest.java279 int scale = 3; in testGetPrecision() local
282 "valueFloat FLOAT , scaleTest NUMERIC("+precisionNum+","+scale+"),"+ in testGetPrecision()
346 int scale = 3; in testGetScale() local
348 "valueFloat FLOAT , scaleTest NUMERIC(10,"+scale+") );"; in testGetScale()
360 assertEquals(scale,rsmd2.getScale(3)); in testGetScale()
/libcore/ojluni/src/main/java/java/sql/
DCallableStatement.java137 void registerOutParameter(int parameterIndex, int sqlType, int scale) in registerOutParameter() argument
301 BigDecimal getBigDecimal(int parameterIndex, int scale) in getBigDecimal() argument
695 void registerOutParameter(String parameterName, int sqlType, int scale) in registerOutParameter() argument
1125 void setObject(String parameterName, Object x, int targetSqlType, int scale) in setObject() argument

123