Home | History | Annotate | Download | only in ec

Lines Matching refs:scale

10  * point is called the <code>scale</code> of the <code>SimpleBigDecimal</code>.
11 * Unlike in {@link java.math.BigDecimal BigDecimal}, the scale is not adjusted
13 * taking part in the same arithmetic operation must have equal scale. The
15 * <code>SimpleBigDecimal</code> with double scale.
23 private final int scale;
30 * @param scale The scale of the <code>SimpleBigDecimal</code> to be
34 public static SimpleBigDecimal getInstance(BigInteger value, int scale)
36 return new SimpleBigDecimal(value.shiftLeft(scale), scale);
42 * 2<sup>scale</sup></code>.
44 * @param scale The scale of the constructed <code>SimpleBigDecimal</code>.
46 public SimpleBigDecimal(BigInteger bigInt, int scale)
48 if (scale < 0)
50 throw new IllegalArgumentException("scale may not be negative");
54 this.scale = scale;
59 if (scale != b.scale)
62 "same scale allowed in arithmetic operations");
70 throw new IllegalArgumentException("scale may not be negative");
73 if (newScale == scale)
78 return new SimpleBigDecimal(bigInt.shiftLeft(newScale - scale),
85 return new SimpleBigDecimal(bigInt.add(b.bigInt), scale);
90 return new SimpleBigDecimal(bigInt.add(b.shiftLeft(scale)), scale);
95 return new SimpleBigDecimal(bigInt.negate(), scale);
105 return new SimpleBigDecimal(bigInt.subtract(b.shiftLeft(scale)),
106 scale);
112 return new SimpleBigDecimal(bigInt.multiply(b.bigInt), scale + scale);
117 return new SimpleBigDecimal(bigInt.multiply(b), scale);
123 BigInteger dividend = bigInt.shiftLeft(scale);
124 return new SimpleBigDecimal(dividend.divide(b.bigInt), scale);
129 return new SimpleBigDecimal(bigInt.divide(b), scale);
134 return new SimpleBigDecimal(bigInt.shiftLeft(n), scale);
145 return bigInt.compareTo(val.shiftLeft(scale));
150 return bigInt.shiftRight(scale);
156 return add(oneHalf.adjustScale(scale)).floor();
181 return scale;
186 if (scale == 0)
193 BigInteger fract = bigInt.subtract(floorBigInt.shiftLeft(scale));
196 fract = ECConstants.ONE.shiftLeft(scale).subtract(fract);
205 char[] fractCharArr = new char[scale];
208 int zeroes = scale - fractLen;
239 return ((bigInt.equals(other.bigInt)) && (scale == other.scale));
244 return bigInt.hashCode() ^ scale;