# US 2014/0181169 A1 · Method, apparatus, system for single-path floating-point rounding flow that supports generation of normals/denormals and associated status flags

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2014/0181169 A1
- Document ID: US20140181169A1
- Status: Published application
- Kind: A1
- Application number: 13/725,268
- Filed: 2012-12-21
- Published: 2014-06-26
- Earliest claimed: 2012-12-21
- Assignees: Intel Corporation
- Inventors: WARREN E. FERGUSON; BRIAN J. HICKMANN; THOMAS D. FLETCHER
- Web page: https://patentgrep.com/patent/US20140181169A1

## CPC

- G06F 17/10: Complex mathematical operations {(function generation by table look-up G06F1/03; evaluation of elementary functions by calculation G06F7/544)}
- G06F 7/00: Methods or arrangements for processing data by operating upon the order or content of the data handled (logic circuits H03K19/00)
- G06F 7/4991: {Overflow or underflow}
- G06F 7/49942: {Significance control}
- G06F 7/49968: {Rounding towards positive infinity (G06F7/49957 takes precedence)}
- G06F 7/49973: {Rounding towards negative infinity, e.g. truncation of two's complement numbers (G06F7/49957 takes precedence)}
- G06F 9/30014: {with variable precision}
- G06F 9/30094: {Condition code generation, e.g. Carry, Zero flag}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A mechanism for performing single-path floating-point rounding in a floating point unit is disclosed. A system of the disclosure includes a memory and a processing device communicably coupled to the memory. In one embodiment, the processing device comprises a floating point unit (FPU) to generate a plurality of status flags for a rounded value of a finite nonzero number. The plurality of status flags are generated based on the finite nonzero number without calculating the rounded value of the finite nonzero number. The plurality of status flags comprises an overflow flag and an underflow flag. The FPU determines whether a rounded value should be calculated for the finite nonzero number based on the plurality of status flags and whether the overflow flag is asserted. Upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is asserted, the FPU calculates the rounded value of the finite nonzero number based on an overflow rounding. Upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is not asserted, the FPU calculates the rounded value of the finite nonzero number based on a blended reduced precision rounding.

## Claims

### Claim 1

A system, comprising:
a memory; and
a processing device communicably coupled to the memory, the processing device comprising a floating point unit (FPU) to:
generate a plurality of status flags for a rounded value of a finite nonzero number, wherein the plurality of status flags are generated based on the finite nonzero number without calculating the rounded value of the finite nonzero number, wherein the plurality of status flags comprises an overflow flag and an underflow flag;
determine whether the overflow flag is asserted;
upon determining that the overflow flag is asserted, calculate the rounded value of the finite nonzero number based on an overflow rounding; and
upon determining that the overflow flag is not asserted, calculate the rounded value of the finite nonzero number based on a blended reduced precision rounding.

### Claim 2 (depends on 1)

The system of claim 1, wherein to generate the plurality of status flags for the rounded value of the finite nonzero number, the processing device is to:
generate a huge flag based on a normalized form of the finite nonzero number;
determine whether the huge flag is asserted;
upon determining that the huge flag is asserted, assert the overflow flag; and
upon determining that the huge flag is not asserted, set the overflow flag to the huge flag.

### Claim 3 (depends on 2)

The system of claim 2, wherein to generate the huge flag based on the normalized form of the finite nonzero number, the processing device is to:
determine whether an exponent of the normalized form of the finite nonzero number is greater than a predefined maximum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined maximum value, assert the huge flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determine whether a round up to huge will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to huge will occur based on the normalized form of the finite nonzero number and the rounding mode, assert the huge flag, and
upon determining that a round up to huge will not occur based on the normalized form of the finite nonzero number and the rounding mode, deassert the huge flag.

### Claim 4 (depends on 1)

The system of claim 1, wherein the plurality of status flags further comprises a precision flag, and wherein to generate the plurality of status flags for the rounded value of the finite nonzero number, the processing device is to:
generate a tiny flag based on a normalized form of the finite nonzero number;
generate a first inexact flag based on the normalized form of the finite;
set the underflow flag to the tiny flag;
set the precision flag to the first inexact flag;
upon determining that an unmasked exception has not occurred,
upon determining that the huge flag is not asserted and upon determining that the tiny flag is asserted,
generate a second inexact flag based on a denormalized form of the finite nonzero number without calculating the rounded value of the finite nonzero number,
update the precision flag based on the second inexact flag, and
update the underflow flag based on the second inexact flag.

### Claim 5 (depends on 4)

The system of claim 4, wherein to generate the tiny flag based on the normalized form of the finite nonzero number, the processing device is to:
determine whether an exponent of the normalized form of the finite nonzero number is greater than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined minimum value, deassert the tiny flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determine whether a round up to normal will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to normal will occur based on the normalized form of the finite nonzero number and the rounding mode, deassert the tiny flag, and
upon determining that a round up to normal will not occur based on the normalized form of the finite nonzero number and the rounding mode, assert the tiny flag.

### Claim 6 (depends on 1)

The system of claim 1, wherein to calculate the rounded value of the finite nonzero number based on a blended reduced precision rounding, the processing device is further to:
determine whether an exponent of a normalized form of the finite nonzero number is less than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is less than the predefined minimum value,
generate a denormalized form of the finite nonzero number by denormalizing the finite nonzero number, and
calculate the rounded value of the finite nonzero number to be a result of rounding the denormalized form of the finite nonzero number; and
upon determining that the exponent of the normalized form of the finite nonzero number is not less than the predefined minimum value, calculate the rounded value of the finite nonzero number to be a result of rounding the normalized form of the finite nonzero number.

### Claim 7

A computer-implemented method, comprising:
generating, by a floating point unit (FPU) of a processing device, a plurality of status flags for a rounded value of a finite nonzero number, wherein the plurality of status flags are generated based on the finite nonzero number without calculating the rounded value of the finite nonzero number, wherein the plurality of status flags comprises an overflow flag and an underflow flag;
determining, by the FPU, whether the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and whether the overflow flag is asserted;
upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is asserted, calculating, by the FPU, the rounded value of the finite nonzero number based on an overflow rounding; and
upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is not asserted, calculating, by the FPU, the rounded value of the finite nonzero number based on a blended reduced precision rounding.

### Claim 8 (depends on 7)

The method of claim 7, wherein generating the plurality of status flags for the rounded value of the finite nonzero number comprises:
generating a huge flag based on a normalized form of the finite nonzero number;
determining whether the huge flag is asserted;
upon determining that the huge flag is asserted, asserting the overflow flag; and
upon determining that the huge flag is not asserted, setting the overflow flag to the huge flag.

### Claim 9 (depends on 8)

The method of claim 8, wherein generating the huge flag based on the normalized form of the finite nonzero number comprises:
determining whether an exponent of the normalized form of the finite nonzero number is greater than a predefined maximum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined maximum value, asserting the huge flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determining whether a round up to huge will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to huge will occur based on the normalized form of the finite nonzero number and the rounding mode, asserting the huge flag, and
upon determining that a round up to huge will not occur based on the normalized form of the finite nonzero number and the rounding mode, deasserting the huge flag.

### Claim 10 (depends on 7)

The method of claim 7, wherein the plurality of status flags further comprises a precision flag, and wherein generating the plurality of status flags for the rounded value of the finite nonzero number comprises:
generating a tiny flag based on a normalized form of the finite nonzero number;
generating a first inexact flag based on the normalized form of the finite;
setting the underflow flag to the tiny flag;
setting the precision flag to the first inexact flag;
upon determining that an unmasked exception has not occurred,
upon determining that the huge flag is not asserted and upon determining that the tiny flag is asserted,
generating a second inexact flag based on a denormalized form of the finite nonzero number without calculating the rounded value of the finite nonzero number,
updating the precision flag based on the second inexact flag, and
updating the underflow flag based on the second inexact flag.

### Claim 11 (depends on 10)

The method of claim 10, wherein generating the tiny flag based on the normalized form of the finite nonzero number comprises:
determining whether an exponent of the normalized form of the finite nonzero number is greater than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined minimum value, deasserting the tiny flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determining whether a round up to normal will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to normal will occur based on the normalized form of the finite nonzero number and the rounding mode, deasserting the tiny flag, and
upon determining that a round up to normal will not occur based on the normalized form of the finite nonzero number and the rounding mode, asserting the tiny flag.

### Claim 12 (depends on 8)

The method of claim 8, wherein calculating the rounded value of the finite nonzero number based on a blended reduced precision rounding comprises:
determining whether an exponent of a normalized form of the finite nonzero number is less than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is less than the predefined minimum value,
generating a denormalized form of the finite nonzero number by denormalizing the finite nonzero number, and
calculating the rounded value of the finite nonzero number to be a result of rounding the denormalized form of the finite nonzero number; and
upon determining that the exponent of the normalized form of the finite nonzero number is not less than the predefined minimum value, calculating the rounded value of the finite nonzero number to be a result of rounding the normalized form of the finite nonzero number.

### Claim 13

A non-transitory machine-readable storage medium including data that, when accessed by a machine, cause the machine to perform operations comprising:
generating, by a processing device of the machine, a plurality of status flags for a rounded value of a finite nonzero number, wherein the plurality of status flags are generated based on the finite nonzero number without calculating the rounded value of the finite nonzero number, wherein the plurality of status flags comprises an overflow flag and an underflow flag;
determining, by the processing device, whether the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and whether the overflow flag is asserted;
upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is asserted, calculating, by the processing device, the rounded value of the finite nonzero number based on an overflow rounding; and
upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is not asserted, calculating, by the processing device, the rounded value of the finite nonzero number based on a blended reduced precision rounding.

### Claim 14 (depends on 13)

The non-transitory machine-readable storage medium of claim 13, wherein generating the plurality of status flags for the rounded value of the finite nonzero number comprises:
generating a huge flag based on a normalized form of the finite nonzero number;
determining whether the huge flag is asserted;
upon determining that the huge flag is asserted, asserting the overflow flag; and
upon determining that the huge flag is not asserted, setting the overflow flag to the huge flag.

### Claim 15 (depends on 14)

The non-transitory machine-readable storage medium of claim 14, wherein generating the huge flag based on the normalized form of the finite nonzero number comprises:
determining whether an exponent of the normalized form of the finite nonzero number is greater than a predefined maximum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined maximum value, asserting the huge flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determining whether a round up to huge will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to huge will occur based on the normalized form of the finite nonzero number and the rounding mode, asserting the huge flag, and
upon determining that a round up to huge will not occur based on the normalized form of the finite nonzero number and the rounding mode, deasserting the huge flag.

### Claim 16 (depends on 13)

The non-transitory machine-readable storage medium of claim 13, wherein the plurality of status flags further comprises a precision flag, and wherein generating the plurality of status flags for the rounded value of the finite nonzero number comprises:
generating a tiny flag based on a normalized form of the finite nonzero number;
generating a first inexact flag based on the normalized form of the finite;
setting the underflow flag to the tiny flag;
setting the precision flag to the first inexact flag;
upon determining that an unmasked exception has not occurred,
upon determining that the huge flag is not asserted and upon determining that the tiny flag is asserted,
generating a second inexact flag based on a denormalized form of the finite nonzero number without calculating the rounded value of the finite nonzero number,
updating the precision flag based on the second inexact flag, and updating the underflow flag based on the second inexact flag.

### Claim 17 (depends on 16)

The non-transitory machine-readable storage medium of claim 16, wherein generating the tiny flag based on the normalized form of the finite nonzero number comprises:
determining whether an exponent of the normalized form of the finite nonzero number is greater than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined minimum value, deasserting the tiny flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determining whether a round up to normal will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to normal will occur based on the normalized form of the finite nonzero number and the rounding mode, deasserting the tiny flag, and
upon determining that a round up to normal will not occur based on the normalized form of the finite nonzero number and the rounding mode, asserting the tiny flag.

### Claim 18 (depends on 14)

The non-transitory machine-readable storage medium of claim 14, wherein calculating the rounded value of the finite nonzero number based on a blended reduced precision rounding comprises:
determining whether an exponent of a normalized form of the finite nonzero number is less than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is less than the predefined minimum value,
generating a denormalized form of the finite nonzero number by denormalizing the finite nonzero number, and
calculating the rounded value of the finite nonzero number to be a result of rounding the denormalized form of the finite nonzero number; and
upon determining that the exponent of the normalized form of the finite nonzero number is not less than the predefined minimum value, calculating the rounded value of the finite nonzero number to be a result of rounding the normalized form of the finite nonzero number.

### Claim 19

A processing device comprising:
a plurality of registers;
a main processing unit; and
a floating point unit (FPU) communicably coupled to the main processing unit, the FPU to:
generate a plurality of status flags for a rounded value of a finite nonzero number, wherein the plurality of status flags are generated based on the finite nonzero number without calculating the rounded value of the finite nonzero number, wherein the plurality of status flags comprises an overflow flag and an underflow flag;
determine whether the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and whether the overflow flag is asserted;
upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is asserted, calculate the rounded value of the finite nonzero number based on an overflow rounding; and
upon determining that the rounded value should be calculated for the finite nonzero number based on the plurality of status flags and that the overflow flag is not asserted, calculate the rounded value of the finite nonzero number based on a blended reduced precision rounding.

### Claim 20 (depends on 19)

The processing device of claim 19, wherein to generate the plurality of status flags for the rounded value of the finite nonzero number, the FPU is to:
generate a huge flag based on a normalized form of the finite nonzero number;
determine whether the huge flag is asserted;
upon determining that the huge flag is asserted, assert the overflow flag; and
upon determining that the huge flag is not asserted, set the overflow flag to the huge flag.

### Claim 21 (depends on 20)

The processing device of claim 20, wherein to generate the huge flag based on the normalized form of the finite nonzero number, the FPU is to:
determine whether an exponent of the normalized form of the finite nonzero number is greater than a predefined maximum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined maximum value, assert the huge flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determine whether a round up to huge will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to huge will occur based on the normalized form of the finite nonzero number and the rounding mode, assert the huge flag, and
upon determining that a round up to huge will not occur based on the normalized form of the finite nonzero number and the rounding mode, deassert the huge flag.

### Claim 22 (depends on 19)

The processing device of claim 19, wherein the plurality of status flags further comprises a precision flag, and wherein to generate the plurality of status flags for the rounded value of the finite nonzero number, the FPU is to:
generate a tiny flag based on a normalized form of the finite nonzero number;
generate a first inexact flag based on the normalized form of the finite;
set the underflow flag to the tiny flag;
set the precision flag to the first inexact flag;
upon determining that an unmasked exception has not occurred,
upon determining that the huge flag is not asserted and upon determining that the tiny flag is asserted, generating a second inexact flag based on a denormalized form of the finite nonzero number without calculating the rounded value of the finite nonzero number,
update the precision flag based on the second inexact flag, and
update the underflow flag based on the second inexact flag.

### Claim 23 (depends on 22)

The processing device of claim 22, wherein to generate the tiny flag based on the normalized form of the finite nonzero number, the FPU is to:
determine whether an exponent of the normalized form of the finite nonzero number is greater than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is greater than the predefined minimum value, deassert the tiny flag; and
upon determining that the exponent of the normalized form of the finite nonzero number is not greater than the predefined maximum value,
determine whether a round up to normal will occur based on the normalized form of the finite nonzero number and a rounding mode,
upon determining that a round up to normal will occur based on the normalized form of the finite nonzero number and the rounding mode, deassert the tiny flag, and
upon determining that a round up to normal will not occur based on the normalized form of the finite nonzero number and the rounding mode, assert the tiny flag.

### Claim 24 (depends on 19)

The processing device of claim 19, wherein to calculate the rounded value of the finite nonzero number based on a blended reduced precision rounding, the FPU is further to:
determine whether an exponent of a normalized form of the finite nonzero number is less than a predefined minimum value;
upon determining that the exponent of the normalized form of the finite nonzero number is less than the predefined minimum value,
generate a denormalized form of the finite nonzero number by denormalizing the finite nonzero number, and
calculate the rounded value of the finite nonzero number to be a result of rounding the denormalized form of the finite nonzero number; and
upon determining that the exponent of the normalized form of the finite nonzero number is not less than the predefined minimum value, calculate the rounded value of the finite nonzero number to be a result of rounding the normalized form of the finite nonzero number.
