Class BigSignificand
java.lang.Object
ch.randelshofer.fastdoubleparser.BigSignificand
A mutable non-negative significand with a fixed number of bits.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBigSignificand(long numBits) Creates a new instance with the specified number in bits. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int value) Adds the specified value to the significand in place.voidfma(int factor, int addend) Multiplies the significand with the specified factor in place, and then adds the specified addend to it (also in place).Converts the BigSignificand to a BigInteger.private intx(int i) private voidx(int i, int value)
-
Field Details
-
LONG_MASK
private static final long LONG_MASK- See Also:
-
readIntBE
-
numInts
private final int numInts -
x
private final byte[] x -
firstNonZeroInt
private int firstNonZeroInt
-
-
Constructor Details
-
BigSignificand
public BigSignificand(long numBits) Creates a new instance with the specified number in bits.- Parameters:
numBits- the number of bits in range [0, Integer.MAX_VALUE).
-
-
Method Details
-
add
public void add(int value) Adds the specified value to the significand in place.- Parameters:
value- the addend, must be a non-negative value- Throws:
ArrayIndexOutOfBoundsException- on overflow
-
fma
public void fma(int factor, int addend) Multiplies the significand with the specified factor in place, and then adds the specified addend to it (also in place).- Parameters:
factor- the multiplication factor, must be a non-negative valueaddend- the addend, must be a non-negative value- Throws:
ArrayIndexOutOfBoundsException- on overflow
-
toBigInteger
Converts the BigSignificand to a BigInteger.- Returns:
- a new BigInteger instance
-
x
private void x(int i, int value) -
x
private int x(int i)
-