# US 2002/0178197 A1 · System and method for generating an integer part of a logarithm of a floating point operand

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

- Number: US 2002/0178197 A1
- Document ID: US20020178197A1
- Status: Published application
- Kind: A1
- Application number: 10/035,585
- Filed: 2001-12-28
- Published: 2002-11-28
- Earliest claimed: 2001-05-25
- Assignees: Sun Microsystems, Inc.
- Inventors: Guy L. Steele JR.
- Web page: https://patentgrep.com/patent/US20020178197A1

## CPC

- G06F 5/012: {in floating-point computations}
- G06F 7/483: Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers {(G06F7/4806, G06F7/4824, G06F7/49, G06F7/491, G06F7/544 take precedence)}
- G06F 7/4876: {Multiplying}
- G06F 7/556: Logarithmic or exponential functions
- G06F 9/30014: {with variable precision}
- G06F 9/30094: {Condition code generation, e.g. Carry, Zero flag}
- G06F 9/3861: {Recovery, e.g. branch miss-prediction, exception handling (error detection or correction G06F11/00)}
- G06F 9/3885: {using a plurality of independent parallel functional units}
- G06F 5/015: {having at least two separately controlled shifting levels, e.g. using shifting matrices (G06F5/012 takes precedence)}
- G06F 7/4873: {Dividing}
- G06F 7/49905: {Exception handling}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A logarithm unit computes an integer part of a logarithm of a floating point operand according to an embodiment of the present invention. The logarithm unit analyzes a format of the floating point operand and generates at least one signal representative of the format. The logarithm unit determines a magnitude of an unbiased exponent of the floating point operand as an intermediate result based on the at least one signal, wherein the unbiased exponent is represented by unbiased exponent bits. Still further, the logarithm unit determines an exponent field and a fraction field high part of the intermediate result. A result is assembled equaling the integer part of the logarithm of the floating point operand based on the at least one signal wherein, if the floating point operand is in at least one of a denormalized format, a normalized non-zero format, and a delimited format, an exponent field of the result equals the exponent field of the intermediate result and a fraction field high part of the result equals the fraction field high part of the intermediate result.

## Claims

### Claim 1

A method for generating an integer part of a logarithm of a floating point operand comprising:
analyzing a format of the floating point operand and generating at least one signal representative of the format;
determining a magnitude of an unbiased exponent of the floating point operand as an intermediate result based on the at least one signal, wherein the unbiased exponent is represented by unbiased exponent bits;
determining an exponent field of the intermediate result;
determining a fraction field high part of the intermediate result; and
assembling a result equal to the integer part of the logarithm of the floating point operand based on the at least one signal wherein, if the floating point operand is in at least one of a denormalized format, a normalized non-zero format, and a delimited format, an exponent field of the result equals the exponent field of the intermediate result and a fraction field high part of the result equals the fraction field high part of the intermediate result.

### Claim 2 (depends on 1)

The method of claim 1, wherein determining the magnitude of the unbiased exponent of the floating point operand as the intermediate result comprises:
determining a magnitude of a difference between exponent field bits of the floating point operand and a predetermined bias, if the format is a normalized non-zero format; and
identifying a number of leading zeros in fraction field bits of the floating point operand and adding the number to the predetermined bias, if the format is a denormalized format.

### Claim 3 (depends on 1)

The method of claim 1, wherein determining the magnitude of the unbiased exponent of the floating point operand as the intermediate result comprises:
identifying a number of trailing zeros in fraction field bits of the floating point operand and adding the number to a predetermined bias, if the format is a delimited format.

### Claim 4 (depends on 1)

The method of claim 1, wherein determining the exponent field of the intermediate result comprises:
identifying a number of leading zeros in the unbiased exponent of the floating point operand and subtracting the number from a predetermined bit pattern to determine the exponent field of the intermediate result.

### Claim 5 (depends on 1)

The method of claim 1, wherein determining the fraction field high part of the intermediate result comprises:
normalizing bits of the unbiased exponent of the floating point operand by determining a number of leading zeros in the unbiased exponent bits, shifting the unbiased exponent bits to the left by the number of leading zeros, and
discarding a most significant bit from the normalized unbiased exponent bits.

### Claim 6 (depends on 1)

The method of claim 1, wherein assembling the result comprises:
setting a sign bit of the result based on the at least one signal representative of the format of the operand;
setting exponent field bits of the result based on the at least one signal representative of the format of the floating point operand; and
setting fraction field bits of the result based on the at least one signal representative of the format of the operand.

### Claim 7 (depends on 6)

The method according to claim 6, wherein setting the sign bit comprises:
setting the sign bit to a first value indicating a negative result if the format is at least one of a negative NaN format, a zero format, an underflow format, and a denormalized format; and
setting the sign bit to a second value indicating a positive result otherwise.

### Claim 8 (depends on 6)

The method according to claim 6, wherein setting the exponent field bits of the result comprises:
setting the exponent field bits of the result to zero if the format of the floating point operand is a normalized non-zero format and the magnitude of the unbiased exponent of the floating point operand is zero;
setting the exponent field bits of the result to a first bit pattern if the format of the floating point operand is at least one of an underflow format and a overflow format; and
setting the exponent field bits of the result to a second bit pattern if the format of the floating point operand is at least one of a zero format, an infinity format, and a NaN format.

### Claim 9 (depends on 8)

The method according to claim 8, wherein:
the first bit pattern is representative of an overflow format.

### Claim 10 (depends on 8)

The method according to claim 8, wherein:
the second bit pattern is representative of one of an infinity and a NaN format.

### Claim 11 (depends on 6)

The method according to claim 6, wherein setting the fraction field bits of the result comprises:
setting the fraction field bits of the result to zero if the format of the floating point operand is a normalized non-zero format and the magnitude of the unbiased exponent of the floating point operand is zero;
setting the fraction field bits of the result to a first bit pattern if the format of the floating point operand is at least one of an underflow format and a overflow format; and
setting the fraction field bits of the result to fraction field bits of the floating point operand if the format of the floating point operand is at least one of an infinity format and a NaN format; and
setting the fraction field bits of the result to zero with the exception that at least one bit of the fraction field bits is set to a first value to indicate a divide-by-zero status, if the format of the floating point operand is a zero format.

### Claim 12 (depends on 11)

The method according to claim 11, wherein:
the first bit pattern is representative of an overflow format.

### Claim 13 (depends on 6)

The method according to claim 6, wherein setting the fraction field bits of the result comprises:
setting the fraction field bits of the result to zero if the format of the floating point operand is a normalized non-zero format and the magnitude of the unbiased exponent of the floating point operand equals zero;
setting the fraction field bits of the result to the fraction field bits of the floating point operand if the format of the floating point operand is at least one of an infinity format and a NaN format; and
setting the fraction field bits of the result to zero and providing at least one status signal having a first value indicating a divide-by-zero status if the format of the floating point operand is a zero format.

### Claim 14 (depends on 1)

The method according to claim 1, further comprising:
embedding status information in the result.

### Claim 15 (depends on 14)

The method according to claim 14, wherein embedding the status information in the result comprises:
setting at least one bit in the result to a first value to indicate a divide-by-zero status if the format of the floating point operand is a zero format.

### Claim 16 (depends on 14)

The method according to claim 14, wherein embedding the status information in the result comprises:
setting at least one bit of the result that stores the status information equivalent to a corresponding bit in the floating point operand that represents the status information.

### Claim 17

A computer-readable medium on which is stored a set of instructions for generating an integer part of a logarithm of a floating point operand, which when executed performs steps comprising:
analyzing a format of the floating point operand and generating at least one signal representative of the format;
determining a magnitude of an unbiased exponent of the floating point operand as an intermediate result based on the at least one signal, wherein the unbiased exponent is represented by unbiased exponent bits;
determining an exponent field of the intermediate result;
determining a fraction field high part of the intermediate result; and
assembling a result equal to the integer part of the logarithm of the floating point operand based on the at least one signal wherein, if the floating point operand is in at least one of a denormalized format, a normalized non-zero format, and a delimited format, an exponent field of the result equals the exponent field of the intermediate result and a fraction field high part of the result equals the fraction field high part of the intermediate result.

### Claim 18 (depends on 17)

The computer-readable medium of claim 17, wherein determining the magnitude of the unbiased exponent of the floating point operand as the intermediate result comprises:
determining a magnitude of a difference between exponent field bits of the floating point operand and a predetermined bias, if the format is a normalized non-zero format; and
identifying a number of leading zeros in fraction field bits of the floating point operand and adding the number to the predetermined bias, if the format is a denormalized format.

### Claim 19 (depends on 17)

The computer-readable medium of claim 17, wherein determining the magnitude of the unbiased exponent of the floating point operand as the intermediate result comprises:
identifying a number of trailing zeros in fraction field bits of the floating point operand and adding the number to a predetermined bias, if the format is a delimited format.

### Claim 20 (depends on 17)

The computer-readable medium of claim 17, wherein determining the exponent field of the intermediate result comprises:
identifying a number of leading zeros in the unbiased exponent of the floating point operand and subtracting the number from a predetermined bit pattern to determine the exponent field of the intermediate result.

### Claim 21 (depends on 17)

The computer-readable medium of claim 17, wherein determining the fraction field high part of the intermediate result comprises:
normalizing bits of the unbiased exponent of the floating point operand by determining a number of leading zeros in the unbiased exponent bits, shifting the unbiased exponent bits to the left by the number of leading zeros, and
discarding a most significant bit from the normalized unbiased exponent bits.

### Claim 22 (depends on 17)

The computer-readable medium of claim 17, wherein assembling the result comprises:
setting a sign bit of the result based on the at least one signal representative of the format of the operand;
setting exponent field bits of the result based on the at least one signal representative of the format of the floating point operand; and
setting fraction field bits of the result based on the at least one signal representative of the format of the operand.

### Claim 23 (depends on 22)

The computer-readable medium of claim 22, wherein setting the sign bit comprises:
setting the sign bit to a first value indicating a negative result if the format is at least one of a negative NaN format, a zero format, an underflow format, and a denormalized format; and
setting the sign bit to a second value indicating a positive result otherwise.

### Claim 24 (depends on 22)

The computer-readable medium of claim 22, wherein setting the exponent field bits of the result comprises:
setting the exponent field bits of the result to zero if the format of the floating point operand is a normalized non-zero format and the magnitude of the unbiased exponent of the floating point operand is zero;
setting the exponent field bits of the result to a first bit pattern if the format of the floating point operand is at least one of an underflow format and a overflow format; and
setting the exponent field bits of the result to a second bit pattern if the format of the floating point operand is at least one of a zero format, an infinity format, and a NaN format.

### Claim 25 (depends on 24)

The computer-readable medium of claim 24, wherein:
the first bit pattern is representative of an overflow format.

### Claim 26 (depends on 24)

The computer-readable medium of claim 24, wherein:
the second bit pattern is representative of one of an infinity and a NaN format.

### Claim 27 (depends on 22)

The computer-readable medium of claim 22, wherein setting the fraction field bits of the result comprises:
setting the fraction field bits of the result to zero if the format of the floating point operand is a normalized non-zero format and the magnitude of the unbiased exponent of the floating point operand is zero;
setting the fraction field bits of the result to a first bit pattern if the format of the floating point operand is at least one of an underflow format and a overflow format; and
setting the fraction field bits of the result to fraction field bits of the floating point operand if the format of the floating point operand is at least one of an infinity format and a NaN format; and
setting the fraction field bits of the result to zero with the exception that at least one bit of the fraction field bits is set to a first value to indicate a divide-by-zero status, if the format of the floating point operand is a zero format.

### Claim 28 (depends on 27)

The computer-readable medium of claim 27, wherein:
the first bit pattern is representative of an overflow format.

### Claim 29 (depends on 22)

The computer-readable medium of claim 22, wherein setting the fraction field bits of the result comprises:
setting the fraction field bits of the result to zero if the format of the floating point operand is a normalized non-zero format and the magnitude of the unbiased exponent of the floating point operand equals zero;
setting the fraction field bits of the result to the fraction field bits of the floating point operand if the format of the floating point operand is at least one of an infinity format and a NaN format; and
setting the fraction field bits of the result to zero and providing at least one status signal having a first value indicating a divide-by-zero status if the format of the floating point operand is a zero format.

### Claim 30 (depends on 17)

The computer-readable medium of claim 17, wherein the set of instructions when executed further embeds status information in the result.

### Claim 31 (depends on 30)

The computer-readable medium of claim 30, wherein embedding the status information in the result comprises:
setting at least one bit in the result to a first value to indicate a divide-by-zero status if the format of the floating point operand is a zero format.

### Claim 32 (depends on 30)

The computer-readable medium of claim 30, wherein embedding the status information in the result comprises:
setting at least one bit of the result that stores the status information equivalent to a corresponding bit in the floating point operand that represents the status information.

### Claim 33

A system for generating an integer part of a logarithm of a floating point operand comprising:
an operand analysis unit for analyzing a format of the floating point operand and generating at least one signal representative of the format;
a processing unit coupled to the operand analysis unit, the processing unit being operative to determine a magnitude of an unbiased exponent of the floating point operand as an intermediate result based on the at least one signal, determine an exponent field of the intermediate result, and determine a fraction field high part of the intermediate result; and
a result generator coupled to the operand analysis unit and the processing unit, the result generator being operative to assemble a result equal to the integer part of the logarithm of the floating point operand based on the at least one signal, wherein, if the floating point operand is in at least one of a denormalized format, a normalized non-zero format, and a delimited format, an exponent field of the result equals the exponent field of the intermediate result and a fraction field high part of the result equals the fraction field high part of the intermediate result.

### Claim 34 (depends on 33)

The system according to claim 33, wherein the floating point operand is in at least one of an underflow format and an overflow format.

### Claim 35 (depends on 33)

The system according to claim 33, wherein status information is stored in the floating point operand and preserved by the result generator within the result.

### Claim 36 (depends on 33)

The system according to claim 33, wherein the result generator is further operative to generate status information that is stored in the resulting operand.
