- java.lang.Object
-
- com.ibm.jzos.fields.IbmDoubleField
-
- All Implemented Interfaces:
DoubleAccessor
,Field
public class IbmDoubleField extends java.lang.Object implements DoubleAccessor
An extended IBM hexadecimal floating pointField
with double accessors.- Since:
- 2.1.0
-
-
Field Summary
Fields Modifier and Type Field Description static long
ALL_NON_SIGN_BITS
static int
BFP_BIAS
IEEE 754 floating-point "double format" bit layout.static long
BFP_EXP_MASK
IEEE 754 floating-point "double format" bit layout.static long
BFP_FRACTION_HON
static long
BFP_FRACTION_IMPLIED_HOB
static int
BFP_FRACTION_LENGTH
IEEE 754 floating-point "double format" bit layout.static long
BFP_FRACTION_MASK
IEEE 754 floating-point "double format" bit layout.static int
BFP_INF_EXP
static int
BYTE_LENGTH
static int
HFP_BIAS
IBM hexadecimal floating-point layout.static long
HFP_EXP_MASK
IBM hexadecimal floating-point layout.static int
HFP_FRACTION_LENGTH
IBM hexadecimal floating-point layout.static long
HFP_FRACTION_MASK
IBM hexadecimal floating-point layout.static int
HFP_MAX_EXP
static long
SIGN_BIT
The sign bit.
-
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 receiverdouble
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 bytesvoid
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)
-
-
-
Field Detail
-
BYTE_LENGTH
public static final int BYTE_LENGTH
- See Also:
- Constant Field Values
-
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
-
ALL_NON_SIGN_BITS
public static final long ALL_NON_SIGN_BITS
- 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
-
BFP_FRACTION_HON
public static final long BFP_FRACTION_HON
- 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
-
HFP_MAX_EXP
public static final int HFP_MAX_EXP
- 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
-
BFP_INF_EXP
public static final int BFP_INF_EXP
- See Also:
- Constant Field Values
-
-
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 interfaceField
- 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 interfaceField
- Returns:
- int
- See Also:
Field.getOffset()
-
setOffset
public void setOffset(int offset)
- Specified by:
setOffset
in interfaceField
- See Also:
Field.setOffset(int)
-
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 interfaceDoubleAccessor
- 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 interfaceDoubleAccessor
- Parameters:
buffer
- the byte arraybufOffset
- 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 interfaceDoubleAccessor
- Parameters:
value
- the float valuebuffer
- 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 interfaceDoubleAccessor
- Parameters:
value
- the float valuebuffer
- the byte arraybufOffset
- 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 nulladouble
-- Returns:
- boolean true if equal, false otherwise
-
-