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$
- Author:
- Harald Kuhr, last modified by $Author: haraldk$
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
double
boolean
static short
floatToShortBits
(float floatValue) Converts a float value to IEEE 754 half-precision bits.float
int
hashCode()
int
intValue()
long
static short
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:
-
-
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
-