Package ghidra.pcode.floatformat
Class FloatFormat
- java.lang.Object
-
- ghidra.pcode.floatformat.FloatFormat
-
public class FloatFormat extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.math.BigDecimalBIG_NaNstatic java.math.BigDecimalBIG_NEGATIVE_INFINITYstatic java.math.BigDecimalBIG_POSITIVE_INFINITYBigFloatmaxValueA constant holding the largest positive finite valueBigFloatminValueA constant holding the smallest positive normal value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigFloatgetBigFloat(double d)BigFloatgetBigFloat(float f)BigFloatgetBigFloat(long encoding)Decodeencodingto a BigFloat using this format.BigFloatgetBigInfinity(boolean sgn)java.math.BigIntegergetBigInfinityEncoding(boolean sgn)BigFloatgetBigNaN(boolean sgn)java.math.BigIntegergetBigNaNEncoding(boolean sgn)java.lang.ObjectgetBigZero(boolean sgn)java.math.BigIntegergetBigZeroEncoding(boolean sgn)longgetEncoding(double host)java.math.BigIntegergetEncoding(BigFloat value)doublegetHostFloat(long encoding)BigFloatgetHostFloat(java.math.BigInteger encoding)longgetInfinityEncoding(boolean sgn)longgetNaNEncoding(boolean sgn)intgetSize()longgetZeroEncoding(boolean sgn)longopAbs(long a)java.math.BigIntegeropAbs(java.math.BigInteger a)longopAdd(long a, long b)java.math.BigIntegeropAdd(java.math.BigInteger a, java.math.BigInteger b)longopCeil(long a)java.math.BigIntegeropCeil(java.math.BigInteger a)longopDiv(long a, long b)java.math.BigIntegeropDiv(java.math.BigInteger a, java.math.BigInteger b)longopEqual(long a, long b)java.math.BigIntegeropEqual(java.math.BigInteger a, java.math.BigInteger b)longopFloat2Float(long a, FloatFormat outformat)java.math.BigIntegeropFloat2Float(java.math.BigInteger a, FloatFormat outformat)longopFloor(long a)java.math.BigIntegeropFloor(java.math.BigInteger a)longopInt2Float(long a, int sizein)java.math.BigIntegeropInt2Float(java.math.BigInteger a, int sizein, boolean signed)longopLess(long a, long b)java.math.BigIntegeropLess(java.math.BigInteger a, java.math.BigInteger b)longopLessEqual(long a, long b)java.math.BigIntegeropLessEqual(java.math.BigInteger a, java.math.BigInteger b)longopMult(long a, long b)java.math.BigIntegeropMult(java.math.BigInteger a, java.math.BigInteger b)longopNan(long a)java.math.BigIntegeropNan(java.math.BigInteger a)longopNeg(long a)java.math.BigIntegeropNeg(java.math.BigInteger a)longopNotEqual(long a, long b)java.math.BigIntegeropNotEqual(java.math.BigInteger a, java.math.BigInteger b)longopRound(long a)java.math.BigIntegeropRound(java.math.BigInteger a)longopSqrt(long a)java.math.BigIntegeropSqrt(java.math.BigInteger a)longopSub(long a, long b)java.math.BigIntegeropSub(java.math.BigInteger a, java.math.BigInteger b)longopTrunc(long a, int sizeout)java.math.BigIntegeropTrunc(java.math.BigInteger a, int sizeout)java.math.BigDecimalround(BigFloat bigFloat)RoundbigFloatusing this format's displayContext.static BigFloattoBigFloat(double d)static BigFloattoBigFloat(float f)static java.lang.StringtoBinaryString(double d)static java.lang.StringtoBinaryString(float f)java.lang.StringtoBinaryString(long encoding)Convert an encoded value to a binary floating point representation.
-
-
-
Field Detail
-
BIG_NaN
public static final java.math.BigDecimal BIG_NaN
-
BIG_POSITIVE_INFINITY
public static final java.math.BigDecimal BIG_POSITIVE_INFINITY
-
BIG_NEGATIVE_INFINITY
public static final java.math.BigDecimal BIG_NEGATIVE_INFINITY
-
maxValue
public final BigFloat maxValue
A constant holding the largest positive finite value
-
minValue
public final BigFloat minValue
A constant holding the smallest positive normal value
-
-
Method Detail
-
getSize
public int getSize()
-
round
public java.math.BigDecimal round(BigFloat bigFloat)
RoundbigFloatusing this format's displayContext.- Parameters:
bigFloat- any BigFloat- Returns:
- a BigDecimal rounded according to this format's displayContext
-
getZeroEncoding
public long getZeroEncoding(boolean sgn)
-
getInfinityEncoding
public long getInfinityEncoding(boolean sgn)
-
getBigZeroEncoding
public java.math.BigInteger getBigZeroEncoding(boolean sgn)
-
getBigZero
public java.lang.Object getBigZero(boolean sgn)
-
getBigInfinityEncoding
public java.math.BigInteger getBigInfinityEncoding(boolean sgn)
-
getBigInfinity
public BigFloat getBigInfinity(boolean sgn)
-
getNaNEncoding
public long getNaNEncoding(boolean sgn)
-
getBigNaNEncoding
public java.math.BigInteger getBigNaNEncoding(boolean sgn)
-
getBigNaN
public BigFloat getBigNaN(boolean sgn)
-
getBigFloat
public BigFloat getBigFloat(float f)
-
getBigFloat
public BigFloat getBigFloat(double d)
-
getBigFloat
public BigFloat getBigFloat(long encoding)
Decodeencodingto a BigFloat using this format. NB: this method should not be used ifsize>8- Parameters:
encoding- the encoding- Returns:
- the decoded value as a BigFloat
-
getHostFloat
public double getHostFloat(long encoding)
-
getHostFloat
public BigFloat getHostFloat(java.math.BigInteger encoding)
-
getEncoding
public long getEncoding(double host)
-
getEncoding
public java.math.BigInteger getEncoding(BigFloat value)
-
toBinaryString
public java.lang.String toBinaryString(long encoding)
Convert an encoded value to a binary floating point representation. NB: this method should not be used ifsize>8- Parameters:
encoding- the encoding of a floating point value in this format- Returns:
- a binary string representation of the encoded floating point
encoding
-
toBigFloat
public static BigFloat toBigFloat(float f)
- Parameters:
f- a float- Returns:
- BigFloat equal to
f
-
toBigFloat
public static BigFloat toBigFloat(double d)
- Parameters:
d- a double- Returns:
- BigFloat equal to
f
-
toBinaryString
public static java.lang.String toBinaryString(float f)
- Parameters:
f- a float- Returns:
- binary representation of
f
-
toBinaryString
public static java.lang.String toBinaryString(double d)
- Parameters:
d- a double- Returns:
- binary representation of
f
-
opEqual
public long opEqual(long a, long b)
-
opEqual
public java.math.BigInteger opEqual(java.math.BigInteger a, java.math.BigInteger b)
-
opNotEqual
public long opNotEqual(long a, long b)
-
opNotEqual
public java.math.BigInteger opNotEqual(java.math.BigInteger a, java.math.BigInteger b)
-
opLess
public long opLess(long a, long b)
-
opLess
public java.math.BigInteger opLess(java.math.BigInteger a, java.math.BigInteger b)
-
opLessEqual
public long opLessEqual(long a, long b)
-
opLessEqual
public java.math.BigInteger opLessEqual(java.math.BigInteger a, java.math.BigInteger b)
-
opNan
public long opNan(long a)
-
opNan
public java.math.BigInteger opNan(java.math.BigInteger a)
-
opAdd
public long opAdd(long a, long b)
-
opAdd
public java.math.BigInteger opAdd(java.math.BigInteger a, java.math.BigInteger b)
-
opSub
public long opSub(long a, long b)
-
opSub
public java.math.BigInteger opSub(java.math.BigInteger a, java.math.BigInteger b)
-
opDiv
public long opDiv(long a, long b)
-
opDiv
public java.math.BigInteger opDiv(java.math.BigInteger a, java.math.BigInteger b)
-
opMult
public long opMult(long a, long b)
-
opMult
public java.math.BigInteger opMult(java.math.BigInteger a, java.math.BigInteger b)
-
opNeg
public long opNeg(long a)
-
opNeg
public java.math.BigInteger opNeg(java.math.BigInteger a)
-
opAbs
public long opAbs(long a)
-
opAbs
public java.math.BigInteger opAbs(java.math.BigInteger a)
-
opSqrt
public long opSqrt(long a)
-
opSqrt
public java.math.BigInteger opSqrt(java.math.BigInteger a)
-
opInt2Float
public long opInt2Float(long a, int sizein)
-
opInt2Float
public java.math.BigInteger opInt2Float(java.math.BigInteger a, int sizein, boolean signed)
-
opFloat2Float
public long opFloat2Float(long a, FloatFormat outformat)
-
opFloat2Float
public java.math.BigInteger opFloat2Float(java.math.BigInteger a, FloatFormat outformat)
-
opTrunc
public long opTrunc(long a, int sizeout)
-
opTrunc
public java.math.BigInteger opTrunc(java.math.BigInteger a, int sizeout)
-
opCeil
public long opCeil(long a)
-
opCeil
public java.math.BigInteger opCeil(java.math.BigInteger a)
-
opFloor
public long opFloor(long a)
-
opFloor
public java.math.BigInteger opFloor(java.math.BigInteger a)
-
opRound
public long opRound(long a)
-
opRound
public java.math.BigInteger opRound(java.math.BigInteger a)
-
-