Detection of potential need to use a larger data format in performing floating point operations
AssigneeInternational Business Machines Corporation
InventorsMichael F. Cowlishaw, Shawn D. Lundvall, Ronald M. Smith, Sr., Phil C. Yeh
Life of this patent
Estimating the term…
Abstract
Detection of whether a result of a floating point operation is safe. Characteristics of the result are examined to determine whether the result is safe or potentially unsafe, as defined by the user. An instruction is provided to facilitate detection of safe or potentially unsafe results.
Claims20
A computer program product for determining whether a decimal floating point number is safe or unsafe, said computer program product comprising:
- a non-transitory computer readable storage medium readable by a processing circuit and storing instructions for performing a method comprising:
- obtaining, by a processor of a processing environment, a machine instruction for execution, the machine instruction comprising an opcode and a register field;
- obtaining, by the processor, a first operand in a decimal floating point format, the first operand included in a register specified by the register field;
- and
- performing, by the processor, a function defined by the opcode of the machine instruction of determining whether the first operand is a safe decimal floating point number or is a potentially unsafe decimal floating point number, said function comprising:
- determining, by the processor, a data group and a sign for the first operand;
- determining, by the processor, a plurality of second operand bits using one or more other fields of the machine instruction, each bit of the plurality of second operand bits corresponding to a data group and sign combination;
- selecting, by the processor, a bit of the plurality of second operand bits based on the data group and sign determined for the first operand;
- determining, by the processor, a value of the selected bit;
- and
- setting, by the processor, a condition code based on the value of the selected bit, the condition code indicating whether a result of a floating point operation is safe or potentially unsafe, wherein unsafe indicates that use of a larger data format would produce a different value or quantum.
A computer system for determining whether a decimal floating point number is safe or unsafe, said computer system comprising:
- a memory;
- and
- a processor in communication with the memory, wherein the computer system is configured to perform a method, said method comprising:
- obtaining, by a processor of a processing environment, a machine instruction for execution, the machine instruction comprising an opcode and a register field;
- obtaining, by the processor, a first operand in a decimal floating point format, the first operand included in a register specified by the register field;
- and
- performing, by the processor, a function defined by the opcode of the machine instruction of determining whether the first operand is a safe decimal floating point number or is a potentially unsafe decimal floating point number, said function comprising:
- determining, by the processor, a data group and a sign for the first operand;
- determining, by the processor, a plurality of second operand bits using one or more other fields of the machine instruction, each bit of the plurality of second operand bits corresponding to a data group and sign combination;
- selecting, by the processor, a bit of the plurality of second operand bits based on the data group and sign determined for the first operand;
- determining, by the processor, a value of the selected bit;
- and
- setting, by the processor, a condition code based on the value of the selected bit, the condition code indicating whether a result of a floating point operation is safe or potentially unsafe, wherein unsafe indicates that use of a larger data format would produce a different value or quantum.
Dependencies are inferred from the claim text.