Package ch.randelshofer.fastdoubleparser
Class BigSignificand
- java.lang.Object
-
- ch.randelshofer.fastdoubleparser.BigSignificand
-
final class BigSignificand extends java.lang.ObjectA mutable non-negative significand with a fixed number of bits.
-
-
Field Summary
Fields Modifier and Type Field Description private intfirstNonZeroIntprivate static longLONG_MASKprivate intnumIntsprivate static java.lang.invoke.VarHandlereadIntBEprivate byte[]x
-
Constructor Summary
Constructors Constructor Description BigSignificand(long numBits)Creates a new instance with the specified number in bits.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(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).java.math.BigIntegertoBigInteger()Converts the BigSignificand to a BigInteger.private intx(int i)private voidx(int i, int value)
-
-
-
Field Detail
-
LONG_MASK
private static final long LONG_MASK
- See Also:
- Constant Field Values
-
readIntBE
private static final java.lang.invoke.VarHandle readIntBE
-
numInts
private final int numInts
-
x
private final byte[] x
-
firstNonZeroInt
private int firstNonZeroInt
-
-
Method Detail
-
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:
java.lang.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:
java.lang.ArrayIndexOutOfBoundsException- on overflow
-
toBigInteger
public java.math.BigInteger 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)
-
-