kz.gamma.hardware.crypto.software.ec
Class SimpleBigDecimal
java.lang.Object
kz.gamma.hardware.crypto.software.ec.SimpleBigDecimal
class SimpleBigDecimal
- extends java.lang.Object
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.
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
bigInt
private final java.math.BigInteger bigInt
scale
private final int scale
SimpleBigDecimal
public SimpleBigDecimal(java.math.BigInteger bigInt,
int scale)
- Constructor for
SimpleBigDecimal. The value of the
constructed SimpleBigDecimal equals bigInt /
2scale.
- Parameters:
bigInt - The bigInt value parameter.scale - The scale of the constructed SimpleBigDecimal.
SimpleBigDecimal
private SimpleBigDecimal(SimpleBigDecimal limBigDec)
getInstance
public static SimpleBigDecimal getInstance(java.math.BigInteger value,
int scale)
- Returns a
SimpleBigDecimal representing the same numerical
value as value.
- Parameters:
value - The value of the SimpleBigDecimal to be
created.scale - The scale of the SimpleBigDecimal to be
created.
- Returns:
- The such created
SimpleBigDecimal.
checkScale
private void checkScale(SimpleBigDecimal b)
adjustScale
public SimpleBigDecimal adjustScale(int newScale)
add
public SimpleBigDecimal add(SimpleBigDecimal b)
add
public SimpleBigDecimal add(java.math.BigInteger b)
negate
public SimpleBigDecimal negate()
subtract
public SimpleBigDecimal subtract(SimpleBigDecimal b)
subtract
public SimpleBigDecimal subtract(java.math.BigInteger b)
multiply
public SimpleBigDecimal multiply(SimpleBigDecimal b)
multiply
public SimpleBigDecimal multiply(java.math.BigInteger b)
divide
public SimpleBigDecimal divide(SimpleBigDecimal b)
divide
public SimpleBigDecimal divide(java.math.BigInteger b)
shiftLeft
public SimpleBigDecimal shiftLeft(int n)
compareTo
public int compareTo(SimpleBigDecimal val)
compareTo
public int compareTo(java.math.BigInteger val)
floor
public java.math.BigInteger floor()
round
public java.math.BigInteger round()
intValue
public int intValue()
longValue
public long longValue()
getScale
public int getScale()
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
Copyright © 2013 Gamma Technologies. All Rights Reserved.