java.lang.Object
com.ibm.jzos.fields.IbmDoubleField
- All Implemented Interfaces:
DoubleAccessor,Field
An extended IBM hexadecimal floating point
Field with double accessors.- Since:
- 2.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final intIEEE 754 floating-point "double format" bit layout.static final longIEEE 754 floating-point "double format" bit layout.static final longstatic final longstatic final intIEEE 754 floating-point "double format" bit layout.static final longIEEE 754 floating-point "double format" bit layout.static final intstatic final intstatic final intIBM hexadecimal floating-point layout.static final longIBM hexadecimal floating-point layout.static final intIBM hexadecimal floating-point layout.static final longIBM hexadecimal floating-point layout.static final intstatic final longThe sign bit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompare a Double with a double for equality.intAnswer the length of the field described by the receiverdoublegetDouble(byte[] buffer) Return an IEEE (binary) double from the given byte array buffer, at the offset of this field.doublegetDouble(byte[] buffer, int bufOffset) Return an IEEE (binary) double from the given byte array buffer, at the bufOffset + offset of this field.intAnswer the offset of this field into some array of bytesvoidputDouble(double value, byte[] buffer) Put a double into the given byte array buffer, at the offset of this field.voidputDouble(double value, byte[] buffer, int bufOffset) Put a double into the given byte array buffer, at the bufOffset + offset of this field.voidsetOffset(int offset)
-
Field Details
-
BYTE_LENGTH
public static final int BYTE_LENGTH- See Also:
-
SIGN_BIT
public static final long SIGN_BITThe 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_MASKIBM 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_MASKIEEE 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_MASKIBM hexadecimal floating-point layout. Bits 62-56 represent the exponent.- See Also:
-
BFP_EXP_MASK
public static final long BFP_EXP_MASKIEEE 754 floating-point "double format" bit layout. Bits 62-52 represent the exponent.- See Also:
-
HFP_FRACTION_LENGTH
public static final int HFP_FRACTION_LENGTHIBM 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_LENGTHIEEE 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_BIASIBM 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_BIASIEEE 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:FieldAnswer the length of the field described by the receiver- Specified by:
getByteLengthin interfaceField- Returns:
- int
- See Also:
-
getOffset
public int getOffset()Description copied from interface:FieldAnswer the offset of this field into some array of bytes -
setOffset
public void setOffset(int offset) -
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:
getDoublein 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:
getDoublein 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:
putDoublein interfaceDoubleAccessor- Parameters:
value- the float valuebuffer- 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:
putDoublein interfaceDoubleAccessor- Parameters:
value- the float valuebuffer- the byte arraybufOffset- the additional offset into the byte array- Throws:
IllegalArgumentException- if the resulting hexadecimal exponent is too large to fit into the IBM representation.
-
equals
Compare a Double with a double for equality.- Parameters:
aDouble- possibly nulladouble-- Returns:
- boolean true if equal, false otherwise
-