Class SimpleBigDecimal
java.lang.Object
org.gudy.bouncycastle.math.ec.SimpleBigDecimal
Class representing a simple version of a big decimal. A
SimpleBigDecimal is basically a
BigInteger with a few digits on the right of
the decimal point. The number of (binary) digits on the right of the decimal
point is called the scale of the SimpleBigDecimal.
Unlike in BigDecimal, the scale is not adjusted
automatically, but must be set manually. All SimpleBigDecimals
taking part in the same arithmetic operation must have equal scale. The
result of a multiplication of two SimpleBigDecimals returns a
SimpleBigDecimal with double scale.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BigIntegerprivate final intprivate static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionSimpleBigDecimal(BigInteger bigInt, int scale) Constructor forSimpleBigDecimal.privateSimpleBigDecimal(SimpleBigDecimal limBigDec) -
Method Summary
Modifier and TypeMethodDescriptionadd(BigInteger b) adjustScale(int newScale) private voidintcompareTo(BigInteger val) intdivide(BigInteger b) doublebooleanfloatfloor()static SimpleBigDecimalgetInstance(BigInteger value, int scale) Returns aSimpleBigDecimalrepresenting the same numerical value asvalue.intgetScale()inthashCode()intintValue()longnegate()round()shiftLeft(int n) toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
bigInt
-
scale
private final int scale
-
-
Constructor Details
-
SimpleBigDecimal
Constructor forSimpleBigDecimal. The value of the constructedSimpleBigDecimalequalsbigInt / 2scale.- Parameters:
bigInt- ThebigIntvalue parameter.scale- The scale of the constructedSimpleBigDecimal.
-
SimpleBigDecimal
-
-
Method Details
-
getInstance
Returns aSimpleBigDecimalrepresenting the same numerical value asvalue.- Parameters:
value- The value of theSimpleBigDecimalto be created.scale- The scale of theSimpleBigDecimalto be created.- Returns:
- The such created
SimpleBigDecimal.
-
checkScale
-
adjustScale
-
add
-
add
-
negate
-
subtract
-
subtract
-
multiply
-
multiply
-
divide
-
divide
-
shiftLeft
-
compareTo
-
compareTo
-
floor
-
round
-
intValue
public int intValue() -
longValue
public long longValue() -
doubleValue
public double doubleValue() -
floatValue
public float floatValue() -
getScale
public int getScale() -
toString
-
equals
-
hashCode
-