Module ibm.jzos

Class IbmDoubleField

java.lang.Object
com.ibm.jzos.fields.IbmDoubleField
All Implemented Interfaces:
DoubleAccessor, Field

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

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static final int
    IEEE 754 floating-point "double format" bit layout.
    static final long
    IEEE 754 floating-point "double format" bit layout.
    static final long
     
    static final long
     
    static final int
    IEEE 754 floating-point "double format" bit layout.
    static final long
    IEEE 754 floating-point "double format" bit layout.
    static final int
     
    static final int
     
    static final int
    IBM hexadecimal floating-point layout.
    static final long
    IBM hexadecimal floating-point layout.
    static final int
    IBM hexadecimal floating-point layout.
    static final long
    IBM hexadecimal floating-point layout.
    static final int
     
    static final long
    The sign bit.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    boolean
    equals(Double aDouble, double adouble)
    Compare a Double with a double for equality.
    int
    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
    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 Details

    • BYTE_LENGTH

      public static final int BYTE_LENGTH
      See Also:
    • 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:
    • ALL_NON_SIGN_BITS

      public static final long ALL_NON_SIGN_BITS
      See Also:
    • 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:
    • 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:
    • BFP_FRACTION_IMPLIED_HOB

      public static final long BFP_FRACTION_IMPLIED_HOB
      See Also:
    • BFP_FRACTION_HON

      public static final long BFP_FRACTION_HON
      See Also:
    • HFP_EXP_MASK

      public static final long HFP_EXP_MASK
      IBM hexadecimal floating-point layout. Bits 62-56 represent the exponent.
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • HFP_MAX_EXP

      public static final int HFP_MAX_EXP
      See Also:
    • 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:
    • BFP_INF_EXP

      public static final int BFP_INF_EXP
      See Also:
  • Constructor Details

    • IbmDoubleField

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

    • 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:
    • 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:
    • setOffset

      public void setOffset(int offset)
      Specified by:
      setOffset in interface Field
      See Also:
    • 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:
      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:
      IllegalArgumentException - if the resulting hexadecimal exponent is too large to fit into the IBM representation.
    • equals

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