Home
last modified time | relevance | path

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

12

/libcore/luni/src/main/java/java/math/
DBigDecimal.java224 private int scale; field in BigDecimal
237 private BigDecimal(long smallValue, int scale){ in BigDecimal() argument
239 this.scale = scale; in BigDecimal()
243 private BigDecimal(int smallValue, int scale){ in BigDecimal() argument
245 this.scale = scale; in BigDecimal()
316 scale = offset - begin; in BigDecimal()
317 bufLength +=scale; in BigDecimal()
318 unscaledBuffer.append(in, begin, scale); in BigDecimal()
320 scale = 0; in BigDecimal()
336 newScale = (long)scale - Integer.parseInt(scaleString); in BigDecimal()
[all …]
DConversion.java137 static String toDecimalScaledString(BigInteger val, int scale) { in toDecimalScaledString() argument
147 switch (scale) { in toDecimalScaledString()
164 if (scale < 0) { in toDecimalScaledString()
169 result1.append(-scale); in toDecimalScaledString()
239 int exponent = resLengthInChars - currentChar - scale - 1; in toDecimalScaledString()
240 if (scale == 0) { in toDecimalScaledString()
247 if ((scale > 0) && (exponent >= -6)) { in toDecimalScaledString()
297 static String toDecimalScaledString(long value, int scale) { in toDecimalScaledString() argument
306 switch (scale) { in toDecimalScaledString()
316 if (scale < 0) { in toDecimalScaledString()
[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()
DOldBigDecimalArithmeticTest.java49 assertEquals("Incorrect scale!", 5, res.scale()); in testAddMathContextNonTrivial()
64 assertEquals("Incorrect scale!", 1, res.scale()); in testSubtractMathContextNonTrivial()
72 assertEquals("Incorrect scale!", 6, res.scale()); in testSubtractMathContextNonTrivial()
89 assertEquals("Incorrect scale!", -16, res.scale()); in testMultiplyMathContextNonTrivial()
121 assertEquals("incorrect scale", cScale, result.scale()); in testPowMathContext()
528 && sum.scale() == 3); in test_addBigDecimal()
627 assertEquals("incorrect scale", newScale, result.scale()); in test_DivideBigDecimalRoundingModeHALF_DOWN()
/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/ojluni/src/main/java/java/util/concurrent/atomic/
DAtomicIntegerArray.java59 int scale = U.arrayIndexScale(int[].class);
60 if ((scale & (scale - 1)) != 0)
62 ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
DAtomicLongArray.java58 int scale = U.arrayIndexScale(long[].class);
59 if ((scale & (scale - 1)) != 0)
61 ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
DAtomicReferenceArray.java66 int scale = U.arrayIndexScale(Object[].class);
67 if ((scale & (scale - 1)) != 0)
69 ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
/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.java3650 int scale = value.scale();
3664 = new BigDecimal(value.unscaledValue(), scale, mc);
3667 = new BigDecimalLayout(v.unscaledValue(), v.scale(),
3704 int scale = value.scale();
3706 if (scale > prec) {
3709 if (compPrec <= scale) {
3713 compPrec -= (scale - prec);
3715 scale,
3721 value.scale(),
3725 int nzeros = (bdl.scale() < prec ? prec - bdl.scale() : 0);
[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/ojluni/src/main/java/java/util/concurrent/
DExchanger.java648 int scale = U.arrayIndexScale(Node[].class);
649 if ((scale & (scale - 1)) != 0 || scale > (1 << ASHIFT))
/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
/libcore/ojluni/src/main/java/javax/sql/
DRowSetMetaData.java193 void setScale(int columnIndex, int scale) throws SQLException; in setScale() argument

12