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.BigDecimal
BIG_NaN
static java.math.BigDecimal
BIG_NEGATIVE_INFINITY
static java.math.BigDecimal
BIG_POSITIVE_INFINITY
BigFloat
maxValue
A constant holding the largest positive finite valueBigFloat
minValue
A constant holding the smallest positive normal value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigFloat
getBigFloat(double d)
BigFloat
getBigFloat(float f)
BigFloat
getBigFloat(long encoding)
Decodeencoding
to a BigFloat using this format.BigFloat
getBigInfinity(boolean sgn)
java.math.BigInteger
getBigInfinityEncoding(boolean sgn)
BigFloat
getBigNaN(boolean sgn)
java.math.BigInteger
getBigNaNEncoding(boolean sgn)
java.lang.Object
getBigZero(boolean sgn)
java.math.BigInteger
getBigZeroEncoding(boolean sgn)
long
getEncoding(double host)
java.math.BigInteger
getEncoding(BigFloat value)
double
getHostFloat(long encoding)
BigFloat
getHostFloat(java.math.BigInteger encoding)
long
getInfinityEncoding(boolean sgn)
long
getNaNEncoding(boolean sgn)
int
getSize()
long
getZeroEncoding(boolean sgn)
long
opAbs(long a)
java.math.BigInteger
opAbs(java.math.BigInteger a)
long
opAdd(long a, long b)
java.math.BigInteger
opAdd(java.math.BigInteger a, java.math.BigInteger b)
long
opCeil(long a)
java.math.BigInteger
opCeil(java.math.BigInteger a)
long
opDiv(long a, long b)
java.math.BigInteger
opDiv(java.math.BigInteger a, java.math.BigInteger b)
long
opEqual(long a, long b)
java.math.BigInteger
opEqual(java.math.BigInteger a, java.math.BigInteger b)
long
opFloat2Float(long a, FloatFormat outformat)
java.math.BigInteger
opFloat2Float(java.math.BigInteger a, FloatFormat outformat)
long
opFloor(long a)
java.math.BigInteger
opFloor(java.math.BigInteger a)
long
opInt2Float(long a, int sizein)
java.math.BigInteger
opInt2Float(java.math.BigInteger a, int sizein, boolean signed)
long
opLess(long a, long b)
java.math.BigInteger
opLess(java.math.BigInteger a, java.math.BigInteger b)
long
opLessEqual(long a, long b)
java.math.BigInteger
opLessEqual(java.math.BigInteger a, java.math.BigInteger b)
long
opMult(long a, long b)
java.math.BigInteger
opMult(java.math.BigInteger a, java.math.BigInteger b)
long
opNan(long a)
java.math.BigInteger
opNan(java.math.BigInteger a)
long
opNeg(long a)
java.math.BigInteger
opNeg(java.math.BigInteger a)
long
opNotEqual(long a, long b)
java.math.BigInteger
opNotEqual(java.math.BigInteger a, java.math.BigInteger b)
long
opRound(long a)
java.math.BigInteger
opRound(java.math.BigInteger a)
long
opSqrt(long a)
java.math.BigInteger
opSqrt(java.math.BigInteger a)
long
opSub(long a, long b)
java.math.BigInteger
opSub(java.math.BigInteger a, java.math.BigInteger b)
long
opTrunc(long a, int sizeout)
java.math.BigInteger
opTrunc(java.math.BigInteger a, int sizeout)
java.math.BigDecimal
round(BigFloat bigFloat)
RoundbigFloat
using this format's displayContext.static BigFloat
toBigFloat(double d)
static BigFloat
toBigFloat(float f)
static java.lang.String
toBinaryString(double d)
static java.lang.String
toBinaryString(float f)
java.lang.String
toBinaryString(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)
RoundbigFloat
using 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)
Decodeencoding
to 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)
-
-