Searched refs:scale (Results 1 - 25 of 30) sorted by relevance

12

/libcore/luni/src/main/java/java/math/
H A DBigDecimal.java30 * <p>A value is represented by an arbitrary-precision "unscaled value" and a signed 32-bit "scale",
31 * combined thus: {@code unscaled * 10<sup>-scale</sup>}. See {@link #unscaledValue} and {@link #scale}.
222 * The 32-bit integer scale in the internal representation of {@code BigDecimal}.
224 private int scale; field in class:BigDecimal
237 private BigDecimal(long smallValue, int scale){ argument
239 this.scale = scale;
243 private BigDecimal(int smallValue, int scale){ argument
245 this.scale
574 BigDecimal(BigInteger unscaledVal, int scale) argument
597 BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) argument
669 valueOf(long unscaledVal, int scale) argument
997 divide(BigDecimal divisor, int scale, int roundingMode) argument
1024 divide(BigDecimal divisor, int scale, RoundingMode roundingMode) argument
1083 divideBigIntegers(BigInteger scaledDividend, BigInteger scaledDivisor, int scale, RoundingMode roundingMode) argument
1119 dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) argument
1779 public int scale() { method in class:BigDecimal
[all...]
H A DConversion.java132 * being scaled by {@code scale}.
137 static String toDecimalScaledString(BigInteger val, int scale) { argument
147 switch (scale) {
164 if (scale < 0) {
169 result1.append(-scale);
239 int exponent = resLengthInChars - currentChar - scale - 1;
240 if (scale == 0) {
247 if ((scale > 0) && (exponent >= -6)) {
297 static String toDecimalScaledString(long value, int scale) { argument
306 switch (scale) {
[all...]
/libcore/luni/src/test/java/libcore/java/math/
H A DOldBigDecimalTest.java75 assertTrue("the number 2.323E102 after setting scale is wrong",
76 setScale2.scale() == 4);
82 assertTrue("the scale of the number -1.253E-12 after setting scale is wrong",
83 setScale2.scale() == 17);
85 "the representation of the number -1.253E-12 after setting scale is wrong, " + setScale2.toString(),
92 "the number 1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong",
93 setScale2.toString().equals("1234.6") && setScale2.scale() == 1);
97 "the number -1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong",
99 && setScale2.scale()
[all...]
H A DOldBigDecimalScaleOperationsTest.java32 assertEquals("incorrect scale", 24, res.scale());
35 assertEquals("incorrect scale", 84, res.scale());
57 assertEquals("incorrect scale", 24, res.scale());
60 assertEquals("incorrect scale", 84, res.scale());
63 assertEquals("incorrect scale", -16, res.scale());
[all...]
H A DOldBigDecimalCompareTest.java61 assertEquals("incorrect scale", 10, res.scale());
H A DOldBigDecimalConstructorsTest.java44 assertEquals("incorrect scale", resScale, result.scale());
112 * new BigDecimal(BigInteger value, int scale, MathContext)
125 assertEquals("incorrect scale", resScale, result.scale());
288 assertEquals("incorrect scale", resScale, result.scale());
441 assertEquals("incorrect scale", resScale, result.scale());
579 assertEquals("incorrect scale", resScal
[all...]
H A DOldBigDecimalConvertTest.java417 assertTrue("incorrect value", result.scale() == 0);
422 assertTrue("incorrect value", result.scale() == 0);
427 assertTrue("incorrect value", result.scale() == 0);
437 assertTrue("incorrect value", bdResult.scale() == iScale);
445 assertTrue("incorrect value", bdResult.scale() == iScale);
H A DBigDecimalTest.java84 assertEquals(21, a.scale());
85 assertEquals(21, b.scale());
127 private static void checkDivide(String expected, long n, long d, int scale, RoundingMode rm) { argument
128 assertEquals(String.format(Locale.US, "%d/%d [%d, %s]", n, d, scale, rm.name()),
130 new BigDecimal(n).divide(new BigDecimal(d), scale, rm));
134 // checkDivide(expected, dividend, divisor, scale, roundingMode)
161 // checkDivide(expected, dividend, divisor, scale, roundingMode)
273 minLong.divide(new BigDecimal("-1"), /* scale = */ 0, RoundingMode.UNNECESSARY));
278 .divide(new BigDecimal("-0.1"), /* scale = */ 0, RoundingMode.UNNECESSARY));
283 .divide(new BigDecimal("-1E+1"), /* scale
[all...]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/
H A DBigDecimalTest.java42 && big.scale() == 0);
52 && big.scale() == 5);
74 && big.scale() == 0);
87 big.scale() == 0);
97 && big.scale() == 14);
101 && big.scale() == 0);
105 && big.scale() == 0);
190 && sum.scale() == 3);
223 && divd3.scale() == divd1.scale());
[all...]
H A DBigDecimalScaleOperationsTest.java28 * Methods: movePointLeft, movePointRight, scale, setScale, unscaledValue *
32 * Check the default scale
38 assertTrue("incorrect scale", aNumber.scale() == cScale);
42 * Check a negative scale
49 assertTrue("incorrect scale", aNumber.scale() == cScale);
53 * Check a positive scale
60 assertTrue("incorrect scale", aNumber.scale()
[all...]
H A DBigDecimalConstructorsTest.java73 assertEquals("incorrect scale", 0, aNumber.scale());
84 * new BigDecimal(BigInteger value, int scale)
92 assertEquals("incorrect scale", aScale, aNumber.scale());
108 assertEquals("incorrect scale", resScale, result.scale());
112 * new BigDecimal(BigInteger value, int scale, MathContext)
125 assertEquals("incorrect scale", resScale, result.scale());
[all...]
H A DBigDecimalArithmeticTest.java46 assertEquals("incorrect scale", cScale, result.scale());
64 assertEquals("incorrect scale", cScale, result.scale());
81 assertEquals("incorrect scale", cScale, result.scale());
99 assertEquals("incorrect scale", cScale, result.scale());
116 assertEquals("incorrect scale", cScale, result.scale());
[all...]
H A DBigDecimalConvertTest.java208 assertEquals("incorrect scale", resScale, result.scale());
222 assertEquals("incorrect scale", resScale, result.scale());
369 * representation; scale == 0.
381 * scale == 0.
393 * scale == 0.
405 * scale == 0.
416 * scale == 0.
446 * Create a BigDecimal from a positive long value; scale
[all...]
H A DBigDecimalCompareTest.java69 assertEquals("incorrect scale", resScale, res.scale());
85 assertEquals("incorrect scale", resScale, res.scale());
89 * Compare to a number of an equal scale
103 * Compare to a number of an equal scale
117 * Compare to a number of an greater scale
131 * Compare to a number of an greater scale
145 * Compare to a number of an less scale
159 * Compare to a number of an less scale
[all...]
/libcore/luni/src/test/java/libcore/libcore/io/
H A DMemoryTest.java35 int scale = SizeOf.INT;
37 byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, scale * values.length + 1);
56 Memory.pokeIntArray(ptr + i * scale, values, i, 1, true);
76 int scale = SizeOf.LONG;
78 byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, scale * values.length + 1);
97 Memory.pokeLongArray(ptr + i * scale, values, i, 1, true);
114 int scale = SizeOf.SHORT;
116 byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, scale * values.length + 1);
135 Memory.pokeShortArray(ptr + i * scale, values, i, 1, true);
/libcore/ojluni/src/main/java/java/util/concurrent/atomic/
H A DAtomicIntegerArray.java59 int scale = U.arrayIndexScale(int[].class);
60 if ((scale & (scale - 1)) != 0)
61 throw new Error("array index scale not a power of two");
62 ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
H A DAtomicLongArray.java58 int scale = U.arrayIndexScale(long[].class);
59 if ((scale & (scale - 1)) != 0)
60 throw new Error("array index scale not a power of two");
61 ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
H A DAtomicReferenceArray.java66 int scale = U.arrayIndexScale(Object[].class);
67 if ((scale & (scale - 1)) != 0)
68 throw new Error("array index scale not a power of two");
69 ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
/libcore/ojluni/src/main/java/javax/sql/
H A DRowSetMetaData.java190 * @param scale the number of digits to right of decimal point
193 void setScale(int columnIndex, int scale) throws SQLException; argument
/libcore/luni/src/main/java/javax/xml/datatype/
H A DDuration.java938 int scale = bd.scale();
940 if (scale == 0) {
946 int insertionPoint = intString.length() - scale;
/libcore/ojluni/src/main/java/java/nio/file/attribute/
H A DFileTime.java208 private static long scale(long d, long m, long over) { method in class:FileTime
236 secs = scale(value, SECONDS_PER_DAY,
240 secs = scale(value, SECONDS_PER_HOUR,
244 secs = scale(value, SECONDS_PER_MINUTE,
/libcore/ojluni/src/main/java/java/util/concurrent/
H A DExchanger.java647 int scale = U.arrayIndexScale(Node[].class);
648 if ((scale & (scale - 1)) != 0 || scale > (1 << ASHIFT))
649 throw new Error("Unsupported array scale");
/libcore/ojluni/src/main/java/java/util/
H A DFormatter.java3649 int scale = value.scale();
3663 = new BigDecimal(value.unscaledValue(), scale, mc);
3666 = new BigDecimalLayout(v.unscaledValue(), v.scale(),
3672 // contain a decimal point if the scale is zero (the internal
3703 int scale = value.scale();
3705 if (scale > prec) {
3706 // more "scale" digits than the requested "precision"
3708 if (compPrec <= scale) {
3783 private int scale; field in class:Formatter.FormatSpecifier.BigDecimalLayout
3785 BigDecimalLayout(BigInteger intVal, int scale, BigDecimalLayoutForm form) argument
3793 public int scale() { method in class:Formatter.FormatSpecifier.BigDecimalLayout
3825 layout(BigInteger intVal, int scale, BigDecimalLayoutForm form) argument
[all...]
/libcore/luni/src/test/java/libcore/java/sql/
H A DOldResultSetMetaDataTest.java279 int scale = 3;
282 "valueFloat FLOAT , scaleTest NUMERIC("+precisionNum+","+scale+"),"+
346 int scale = 3;
348 "valueFloat FLOAT , scaleTest NUMERIC(10,"+scale+") );";
360 assertEquals(scale,rsmd2.getScale(3));
/libcore/ojluni/src/main/java/java/sql/
H A DCallableStatement.java88 * <code>registerOutParameter</code> that accepts a scale value
123 * @param scale the desired number of digits to the right of the
137 void registerOutParameter(int parameterIndex, int sqlType, int scale) argument
283 * <code>java.math.BigDecimal</code> object with <i>scale</i> digits to
287 * @param scale the number of digits to the right of the decimal point
300 BigDecimal getBigDecimal(int parameterIndex, int scale) argument
643 * <code>registerOutParameter</code> that accepts a scale value
678 * @param scale the desired number of digits to the right of the
694 void registerOutParameter(String parameterName, int sqlType, int scale) argument
1106 * sent to the database. The scale argumen
1124 setObject(String parameterName, Object x, int targetSqlType, int scale) argument
[all...]

Completed in 610 milliseconds

12