Class FpFormat
- java.lang.Object
-
- ru.ispras.testbase.knowledge.floating.FpFormat
-
public final class FpFormat extends java.lang.Object
FpFormat
represents a floating-point number format.
-
-
Constructor Summary
Constructors Constructor Description FpFormat(int exponentLength, int fractionLength)
Constructs a floating-point number format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getBits(long sign, long exponent, long fraction)
Returns the bit representation of the floating-point number.long
getExponent(long bits)
Returns the exponent of the given floating-point number.long
getExponentBias()
Returns the exponent bias.int
getExponentLength()
Returns the exponent length.long
getExponentMask()
Returns the exponent mask.long
getFraction(long bits)
Returns the fraction of the given floating-point number.int
getFractionLength()
Returns the fraction length.long
getFractionMask()
Returns the fraction mask.int
getLength()
Returns the bit length of a floating-point number.long
getMaxNormalizedExponent()
Returns the maximal exponent of a normalized floating-point number.long
getMinNormalizedExponent()
Returns the minimal exponent of a normalized floating-point number.int
getPrecision()
Returns the precision (the fraction length plus one).long
getSign(long bits)
Returns the sign of the given floating-point number.int
getSignLength()
Returns the sign length.long
getSignMask()
Returns the sign length.FpNumber
valueOf(long sign, long exponent, long fraction)
Constructs a floating-point number.FpNumber
valueOfBits(long bits)
Constructs a floating-point number.FpNumber
valueOfUnsigned(long value)
Constructs a floating-point number.
-
-
-
Method Detail
-
getLength
public int getLength()
Returns the bit length of a floating-point number.- Returns:
- the length.
-
getFractionLength
public int getFractionLength()
Returns the fraction length.- Returns:
- the fraction length.
-
getExponentLength
public int getExponentLength()
Returns the exponent length.- Returns:
- the exponent length.
-
getSignLength
public int getSignLength()
Returns the sign length.- Returns:
- the sign length.
-
getFractionMask
public long getFractionMask()
Returns the fraction mask.- Returns:
- the fraction mask.
-
getExponentMask
public long getExponentMask()
Returns the exponent mask.- Returns:
- the exponent mask.
-
getSignMask
public long getSignMask()
Returns the sign length.- Returns:
- the sign length.
-
getPrecision
public int getPrecision()
Returns the precision (the fraction length plus one).- Returns:
- the precision.
-
getExponentBias
public long getExponentBias()
Returns the exponent bias.- Returns:
- the exponent bias.
-
getMinNormalizedExponent
public long getMinNormalizedExponent()
Returns the minimal exponent of a normalized floating-point number.- Returns:
- the minimal normalized exponent.
-
getMaxNormalizedExponent
public long getMaxNormalizedExponent()
Returns the maximal exponent of a normalized floating-point number.- Returns:
- the maximal normalized exponent.
-
getFraction
public long getFraction(long bits)
Returns the fraction of the given floating-point number.- Parameters:
bits
- the bits representing the floating-point number.- Returns:
- the fraction.
-
getExponent
public long getExponent(long bits)
Returns the exponent of the given floating-point number.- Parameters:
bits
- the bits representing the floating-point number.- Returns:
- the exponent.
-
getSign
public long getSign(long bits)
Returns the sign of the given floating-point number.- Parameters:
bits
- the bits representing the floating-point number.- Returns:
- the exponent.
-
getBits
public long getBits(long sign, long exponent, long fraction)
Returns the bit representation of the floating-point number.- Parameters:
sign
- the sign.exponent
- the exponent.fraction
- the fraction.- Returns:
- the bits representing the floating-point number.
-
valueOf
public FpNumber valueOf(long sign, long exponent, long fraction)
Constructs a floating-point number.- Parameters:
sign
- the sign.exponent
- the exponent.fraction
- the fraction.- Returns:
- the the floating-point number.
-
valueOfBits
public FpNumber valueOfBits(long bits)
Constructs a floating-point number.- Parameters:
bits
- the bit representation.- Returns:
- the the floating-point number.
-
valueOfUnsigned
public FpNumber valueOfUnsigned(long value)
Constructs a floating-point number.- Parameters:
value
- the unsigned integer value.- Returns:
- the the floating-point number.
-
-