Module ibm.jzos

Class IbmDoubleField

  • All Implemented Interfaces:
    DoubleAccessor, Field

    public class IbmDoubleField
    extends java.lang.Object
    implements DoubleAccessor
    An extended IBM hexadecimal floating point Field with double accessors.
    Since:
    2.1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      IbmDoubleField​(int offset)
      Construct an instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Double aDouble, double adouble)
      Compare a Double with a double for equality.
      int getByteLength()
      Answer the length of the field described by the receiver
      double getDouble​(byte[] buffer)
      Return an IEEE (binary) double from the given byte array buffer, at the offset of this field.
      double getDouble​(byte[] buffer, int bufOffset)
      Return an IEEE (binary) double from the given byte array buffer, at the bufOffset + offset of this field.
      int getOffset()
      Answer the offset of this field into some array of bytes
      void putDouble​(double value, byte[] buffer)
      Put a double into the given byte array buffer, at the offset of this field.
      void putDouble​(double value, byte[] buffer, int bufOffset)
      Put a double into the given byte array buffer, at the bufOffset + offset of this field.
      void setOffset​(int offset)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SIGN_BIT

        public static final long SIGN_BIT
        The sign bit. Used by both IEEE 754 floating-point "double format" bit layout and IBM 8-byte "double precision" hexadecimal floating-point layout.
        See Also:
        Constant Field Values
      • HFP_FRACTION_MASK

        public static final long HFP_FRACTION_MASK
        IBM hexadecimal floating-point layout. The least significant 7 bytes represent the significand of the floating point number.
        See Also:
        Constant Field Values
      • BFP_FRACTION_MASK

        public static final long BFP_FRACTION_MASK
        IEEE 754 floating-point "double format" bit layout. Bits 51-0 represent the significand (sometimes called the mantissa) of the floating-point number.
        See Also:
        Constant Field Values
      • BFP_FRACTION_IMPLIED_HOB

        public static final long BFP_FRACTION_IMPLIED_HOB
        See Also:
        Constant Field Values
      • HFP_EXP_MASK

        public static final long HFP_EXP_MASK
        IBM hexadecimal floating-point layout. Bits 62-56 represent the exponent.
        See Also:
        Constant Field Values
      • BFP_EXP_MASK

        public static final long BFP_EXP_MASK
        IEEE 754 floating-point "double format" bit layout. Bits 62-52 represent the exponent.
        See Also:
        Constant Field Values
      • HFP_FRACTION_LENGTH

        public static final int HFP_FRACTION_LENGTH
        IBM hexadecimal floating-point layout. The length, in number of bits, to represent the mantissa of the floating-point number.
        See Also:
        Constant Field Values
      • BFP_FRACTION_LENGTH

        public static final int BFP_FRACTION_LENGTH
        IEEE 754 floating-point "double format" bit layout. The length, in number of bits, to represent the mantissa of the floating-point number.
        See Also:
        Constant Field Values
      • HFP_BIAS

        public static final int HFP_BIAS
        IBM hexadecimal floating-point layout. Excess bias of 64, which means to subtract 64 to get the actual exponent.
        See Also:
        Constant Field Values
      • BFP_BIAS

        public static final int BFP_BIAS
        IEEE 754 floating-point "double format" bit layout. Excess bias of 1023, which means to subtract 1023 to get the actual exponent.
        See Also:
        Constant Field Values
    • Constructor Detail

      • IbmDoubleField

        public IbmDoubleField​(int offset)
        Construct an instance.
        Parameters:
        offset - int the offset in some byte array to the start of this field.
    • Method Detail

      • getByteLength

        public int getByteLength()
        Description copied from interface: Field
        Answer the length of the field described by the receiver
        Specified by:
        getByteLength in interface Field
        Returns:
        int
        See Also:
        Field.getByteLength()
      • getOffset

        public int getOffset()
        Description copied from interface: Field
        Answer the offset of this field into some array of bytes
        Specified by:
        getOffset in interface Field
        Returns:
        int
        See Also:
        Field.getOffset()
      • getDouble

        public double getDouble​(byte[] buffer)
        Return an IEEE (binary) double from the given byte array buffer, at the offset of this field.
        Specified by:
        getDouble in interface DoubleAccessor
        Parameters:
        buffer - the byte array
        Returns:
        double
      • getDouble

        public double getDouble​(byte[] buffer,
                                int bufOffset)
        Return an IEEE (binary) double from the given byte array buffer, at the bufOffset + offset of this field.
        Specified by:
        getDouble in interface DoubleAccessor
        Parameters:
        buffer - the byte array
        bufOffset - the additional offset into the byte array
        Returns:
        double
      • putDouble

        public void putDouble​(double value,
                              byte[] buffer)
        Put a double into the given byte array buffer, at the offset of this field.
        Specified by:
        putDouble in interface DoubleAccessor
        Parameters:
        value - the float value
        buffer - the byte array
        Throws:
        java.lang.IllegalArgumentException - if the resulting hexadecimal exponent is too large to fit into the IBM representation.
      • putDouble

        public void putDouble​(double value,
                              byte[] buffer,
                              int bufOffset)
        Put a double into the given byte array buffer, at the bufOffset + offset of this field.
        Specified by:
        putDouble in interface DoubleAccessor
        Parameters:
        value - the float value
        buffer - the byte array
        bufOffset - the additional offset into the byte array
        Throws:
        java.lang.IllegalArgumentException - if the resulting hexadecimal exponent is too large to fit into the IBM representation.
      • equals

        public boolean equals​(java.lang.Double aDouble,
                              double adouble)
        Compare a Double with a double for equality.
        Parameters:
        aDouble - possibly null
        adouble -
        Returns:
        boolean true if equal, false otherwise