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 floatprivate final shortstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdoublebooleanprivate static intfloatTo16Bits(float floatValue) static shortfloatToShortBits(float floatValue) Converts a float value to IEEE 754 half-precision bits.floatinthashCode()intintValue()longstatic shortprivate Objectstatic floatshortBitsToFloat(short shortBits) Converts an IEEE 754 half-precision data type to single-precision.toString()static HalfMethods inherited from class 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
-
longValue
-
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein classNumber
-
hashCode
-
equals
-
compareTo
- Specified by:
compareToin 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
-