java.lang.Object
java.lang.Number
com.twelvemonkeys.imageio.metadata.tiff.Half
All Implemented Interfaces:
Serializable, Comparable<Half>

public final class Half extends Number implements 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 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()
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Specified by:
      longValue in class Number
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Number
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Half other)
      Specified by:
      compareTo in interface Comparable<Half>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • valueOf

      public static Half valueOf(String value) throws NumberFormatException
      Throws:
      NumberFormatException
    • parseHalf

      public static short parseHalf(String value) throws NumberFormatException
      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

      private Object readResolve()