Class Half
java.lang.Object
java.lang.Number
com.twelvemonkeys.imageio.metadata.tiff.Half
- All Implemented Interfaces:
Serializable
,Comparable<Half>
IEEE 754 half-precision floating point data type.
- Version:
- $Id: Half.java,v 1.0 10/04/2021 haraldk Exp$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final float
private final short
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
double
boolean
private static int
floatTo16Bits
(float floatValue) static short
floatToShortBits
(float floatValue) Converts a float value to IEEE 754 half-precision bits.float
int
hashCode()
int
intValue()
long
static short
private Object
static float
shortBitsToFloat
(short shortBits) Converts an IEEE 754 half-precision data type to single-precision.toString()
static Half
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
SIZE
public static final int SIZE- See Also:
-
shortBits
private final short shortBits -
floatValue
private final transient float floatValue
-
-
Constructor Details
-
Half
public Half(short shortBits)
-
-
Method Details
-
intValue
public int intValue() -
longValue
public long longValue() -
floatValue
public float floatValue()- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValue
in classNumber
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Half>
-
toString
-
valueOf
- Throws:
NumberFormatException
-
parseHalf
- Throws:
NumberFormatException
-
shortBitsToFloat
public static float shortBitsToFloat(short shortBits) Converts an IEEE 754 half-precision data type to single-precision.- Parameters:
shortBits
- a 16 bit half precision value- Returns:
- an IEE 754 single precision float
-
floatToShortBits
public static short floatToShortBits(float floatValue) Converts a float value to IEEE 754 half-precision bits.- Parameters:
floatValue
- a float value- Returns:
- the IEE 754 single precision 16 bits value
-
floatTo16Bits
private static int floatTo16Bits(float floatValue) -
readResolve
-