# US 6,732,134 B1 · Handler for floating-point denormalized numbers

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

- Number: US 6,732,134 B1
- Document ID: US6732134B1
- Status: Granted
- Kind: B1
- Application number: 09/659,747
- Filed: 2000-09-11
- Granted: 2004-05-04
- Earliest claimed: 2000-09-11
- Assignees: Apple Computer, Inc.
- Inventors: Alexander Rosenberg; Ali Sazegari
- Web page: https://patentgrep.com/patent/US6732134B1

## CPC

- G06F 7/499: Denomination or exception handling, e.g. rounding or overflow
- G06F 7/49936: {Normalisation mentioned as feature only}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Operations that involve denormalized numbers are handled by restructuring the input values for an operation as normalized numbers, and performing calculations on the normalized numbers. As a first step in the process of performing an operation, a determination is made whether input values for the operation contain one or more denormalized numbers. For certain types of operations, a determination is made whether the input values are such that the output value from the operation will be a denormalized number. For each operation in which either the input values or output values comprise a denormalized number, the input values are scaled to produce values that are not denormalized. Once the appropriate factoring has been carried out, the requested operation is performed, using normalized numbers, to produce an intermediate result which is then adjusted to account for the initial scaling.

## Claims

### Claim 1

A method for performing an operation within a processor, comprising the steps of:
detecting whether a condition exists where at least one of a given input value, or an output value resulting from an operation on said given input value, lies within a range of denormalized numbers;
scaling said given input value to produce a modified value which is a normalized number;
performing said operation on said modified value using an instruction which is associated with normalized numbers, to produce an intermediate result; and
adjusting said intermediate result in accordance with said scaling to produce a final result.

### Claim 2 (depends on 1)

The method of claim 1 wherein said given input value is multiplied by a factor which is a power of two to produce said modified value.

### Claim 3 (depends on 2)

The method of claim 2 wherein said power of two is determined on the basis of the number of leading zeroes in a binary representation of said given input value.

### Claim 4 (depends on 2)

The method of claim 2 wherein said operation is the reciprocal of the square root of said given input value, and said adjusting step includes multiplying said intermediate result by the reciprocal of the square root of the inverse of said factor.

### Claim 5 (depends on 2)

The method of claim 2 wherein said operation is the reciprocal of said given input value.

### Claim 6 (depends on 5)

The method of claim 5 wherein said adjusting step includes multiplying said intermediate result by said factor.

### Claim 7 (depends on 5)

The method of claim 5, further including the step of determining whether said given input value is less than a lower threshold, and producing a final result of infinity in lieu of said scaling, performing and adjusting steps.

### Claim 8 (depends on 5)

The method of claim 5, further including the step of determining whether said given input value is greater than an upper threshold, and wherein said factor is a negative power of two when said given input value exceeds said upper threshold.

### Claim 9 (depends on 8)

The method of claim 8 wherein said adjusting step includes multiplying said intermediate result by said factor when said given input value exceeds said upper threshold.

### Claim 10 (depends on 2)

The method of claim 2 wherein said operation is the logarithm of the given input value, and said adjusting step includes subtracting a value equal to said power from said intermediate result.

### Claim 11 (depends on 1)

The method of claim 1 wherein said operation is an exponential function, and said scaling step includes factoring said given input value into two numbers which are normalized numbers.

### Claim 12 (depends on 11)

The method of claim 11 wherein one of said two numbers is a constant number that is used for all exponential functions that are performed on denormalized numbers.

### Claim 13

A method for handling denormalized numbers in a vector processing engine which does not include a denormal processor, comprising the steps of:
examining a vector of input values to identify any values in said vector that are denormalized numbers, or that would result in denormalized numbers when a given operation is performed on them;
creating a mask that distinguishes the identified values from other values in the vector;
scaling the identified values to produce modified values;
performing said given operation on the modified values and said other values, to produce a vector containing an intermediate result; and
adjusting the value of said intermediate result in accordance with said mask, in a manner corresponding to said scaling, to produce a final result vector.

### Claim 14 (depends on 13)

The method of claim 13 wherein said operation is performed simultaneously on said modified values and on said other values.

### Claim 15 (depends on 13)

The method of claim 13 wherein said modified values are contained in a first vector, and said other values are contained in a second vector, and said vector containing said intermediate result is produced from said first vector.

### Claim 16 (depends on 13)

The method of claim 13 wherein said other values include any one or more of normalized numbers, infinity and NaNs.

### Claim 17 (depends on 13)

The method of claim 13 wherein said identified values are multiplied by a factor which is a power of two to produce said modified value.

### Claim 18 (depends on 17)

The method of claim 17 wherein said power of two is determined on the basis of the number of leading zeroes in a binary representation of each identified value.

### Claim 19 (depends on 17)

The method of claim 17 wherein said operation is the reciprocal of the square root of said given input value, and said adjusting step includes multiplying said intermediate result by the reciprocal of the square root of the inverse of said factor.

### Claim 20 (depends on 17)

The method of claim 17 wherein said operation is the reciprocal of an input value.

### Claim 21 (depends on 20)

The method of claim 20 wherein said adjusting step includes multiplying said intermediate result by said factor.

### Claim 22 (depends on 20)

The method of claim 20, further including the step of determining whether an identified value is less than a lower threshold, and producing a final result of infinity in lieu of said scaling, performing and adjusting steps.

### Claim 23 (depends on 20)

The method of claim 20, further including the step of determining whether a value in said vector of input values is greater than an upper threshold, and wherein said factor is a negative power of two when an input value exceeds said upper threshold.

### Claim 24 (depends on 23)

The method of claim 23 wherein said adjusting step includes multiplying said intermediate result by said factor when said given input value exceeds said upper threshold.

### Claim 25 (depends on 17)

The method of claim 17 wherein said operation is the logarithm of an input value, and said adjusting step includes subtracting a value equal to said power from said intermediate result.

### Claim 26 (depends on 13)

The method of claim 13 wherein said operation is an exponential function, and said scaling step includes factoring an input value into two numbers which are normalized numbers.

### Claim 27 (depends on 26)

The method of claim 26 wherein one of said two numbers is a constant number that is used for all exponential functions that are performed on denormalized numbers.

### Claim 28

A computer-readable medium containing a program that executes the following steps:
detecting whether a condition exists where at least one of a given input value, or an output value resulting from an operation on said given input value, lies within a range of denormalized numbers;
scaling said given input value to produce a modified value which is a normalized number;
performing said operation on said modified value using an instruction which is associated with normalized numbers, to produce an intermediate result; and
adjusting said intermediate result in accordance with said scaling to produce a final result.

### Claim 29

A computer-readable medium containing a program that executes the following steps:
examining a vector of input values to identify any values in said vector that are denormalized numbers, or that would result in denormalized numbers when a given operation is performed on them;
creating a mask that distinguishes the identified values from other values in the vector;
scaling the identified values to produce a vector containing modified values;
performing said given operation on the modified values and said other values, to produce a vector containing an intermediate result; and
adjusting values in said vector containing an intermediate result in accordance with said mask, in a manner corresponding to said scaling, to produce a final result vector.

### Claim 30

A vector processing engine having associated therewith a set of instructions which perform the following actions:
examining a vector of input values to identify any values in said vector that are denormalized numbers, or that would result in denormalized numbers when a given operation is performed on them;
creating a mask that distinguishes the identified values from other values in the vector;
scaling the identified values to produce a vector containing modified values;
performing said given operation on the modified values and said other values, to produce a vector containing an intermediate result; and
adjusting values in said vector containing an intermediate result in accordance with said mask, in a manner corresponding to said scaling, to produce a final result vector.

### Claim 31 (depends on 30)

The vector processing engine of claim 30 wherein said operation is performed simultaneously on said modified values and on said other values.

### Claim 32 (depends on 30)

The vector processing engine of claim 30 wherein said modified values are contained in a first vector, and said other values are contained in a second vector, and said vector containing an intermediate result is produced from said first vector.

### Claim 33 (depends on 30)

The vector processing engine of claim 30 wherein said other values include any one or more of normalized numbers, infinity and NaNs.

### Claim 34 (depends on 30)

The vector processing engine of claim 30 wherein said identified values are multiplied by a factor which is a power of two to produce said modified value.

### Claim 35 (depends on 34)

The vector processing engine of claim 34 wherein said power of two is determined on the basis of the number of leading zeroes in a binary representation of each identified value.

### Claim 36 (depends on 34)

The vector processing engine of claim 34 wherein said operation is the reciprocal of the square root of said given input value, and said adjustment is carried out by multiplying said intermediate result by the reciprocal of the square root of the inverse of said factor.

### Claim 37 (depends on 34)

The vector processing engine of claim 34 wherein said operation is the reciprocal of an input value.

### Claim 38 (depends on 37)

The vector processing engine of claim 37 wherein said adjustment is carried out by multiplying said intermediate result by said factor.

### Claim 39 (depends on 37)

The vector processing engine of claim 37, further including instructions for determining whether an identified value is less than a lower threshold, and producing a final result of infinity in lieu of said scaling, performing and adjusting actions.

### Claim 40 (depends on 37)

The vector processing engine of claim 37, further including the instructions for determining whether a value in said vector of input values is greater than an upper threshold, and wherein said factor is a negative power of two when an input value exceeds said upper threshold.

### Claim 41 (depends on 40)

The vector processing engine of claim 40 wherein said adjustment is carried out by multiplying said intermediate result by said factor when said given input value exceeds said upper threshold.

### Claim 42 (depends on 34)

The vector processing engine of claim 34 wherein said operation is the logarithm of an input value, and said adjustment is carried out by subtracting a value equal to said power from said intermediate result.

### Claim 43 (depends on 30)

The vector processing engine of claim 30 wherein said operation is an exponential function, and said scaling action includes factoring an input value into two numbers which are normalized numbers.

### Claim 44 (depends on 43)

The vector processing engine of claim 43 wherein one of said two numbers is a constant number that is used for all exponential functions that are performed on denormalized numbers.
