# US 7,080,364 B2 · Methods and apparatus for compiling a transcendental floating-point operation

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

- Number: US 7,080,364 B2
- Document ID: US7080364B2
- Status: Granted
- Kind: B2
- Application number: 10/424,600
- Filed: 2003-04-28
- Published: 2004-10-28
- Granted: 2006-07-18
- Earliest claimed: 2003-04-28
- Assignees: Intel Corporation
- Inventors: Ping T. Tang; Cristina S. Iordache
- Web page: https://patentgrep.com/patent/US7080364B2

## CPC

- 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/556: Logarithmic or exponential functions
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods and an apparatus for compiling a transcendental floating-point operation are disclosed. The disclosed techniques compile a transcendental floating-point operation by replacing the transcendental floating-point operation with an integer-based routine (e.g., a single routine) hand-coded to perform the transcendental floating-point operation. Each of the instructions in the integer-based routine, including the integer operations, is compiled directly into opcodes without primitive floating-point emulation calls. As a result, function nesting is reduced and more efficient algorithms are used. The disclosed system does not simply emulate basic floating-point operations using integer operations. Instead, portions of the computation are isolated where fixed-point accuracy is sufficient and thus native integer computations can be used. For example, computing (log(1+Z)−Z)/Z instead of computing log(1+Z).

## Claims

### Claim 1

A method of compiling a transcendental floating-point operation, the method comprising:
reading a plurality of source code instructions including the transcendental floating-point operation;
retrieving a predetermined integer-based function to perform the transcendental floating-point operation in response to reading the transcendental floating-point operation; and
compiling the plurality of source code instructions to produce an object code, the object code including instructions based on the predetermined integer-based function.

### Claim 2 (depends on 1)

A method as defined in claim 1, further comprising determining that a target processor does not include a native floating-point unit.

### Claim 3 (depends on 1)

A method as defined in claim 1, wherein retrieving the predetermined integer-based function comprises retrieving the predetermined integer-based function from a run-time library.

### Claim 4 (depends on 3)

A method as defined in claim 3, wherein retrieving the predetermined integer-based function from the run-time library comprises retrieving a hand-coded software function.

### Claim 5 (depends on 3)

A method as defined in claim 3, wherein retrieving the predetermined integer-based function from the run-time library comprises retrieving a hand-coded software function structured to perform the floating-point operation using no floating-point instructions.

### Claim 6 (depends on 1)

A method as defined in claim 1, further comprising storing the predetermined integer-based function.

### Claim 7 (depends on 6)

A method as defined in claim 6, wherein storing the predetermined integer-based function comprises storing at least one of an exponential function and a logarithmic function.

### Claim 8 (depends on 6)

A method as defined in claim 6, wherein storing the predetermined integer-based function comprises storing at least one of a sine function using no floating-point instructions, a cosine function using no floating-point instructions, and a tangent function using no floating-point instructions.

### Claim 9 (depends on 1)

A method as defined in claim 1, wherein basic floating-point operations are not emulated using integer operations.

### Claim 10 (depends on 1)

A method as defined in claim 1, wherein portions of the transcendental floating-point operation are isolated where fixed-point accuracy is sufficient.

### Claim 11

A method of compiling a transcendental floating-point operation for a target processor, the method comprising:
reading a plurality of source code instructions including the transcendental floating-point operation; and
compiling the plurality of source code instructions to produce an object code, the object code including instructions based on a predetermined integer-based function structured to perform the transcendental floating-point operation if the target processor does not include a native floating-point unit, the object code excluding instructions based on the predetermined integer-based function if the target processor does include a native floating-point unit.

### Claim 12 (depends on 11)

A method as defined in claim 11, further comprising determining that the target processor does not include a native floating-point unit.

### Claim 13 (depends on 12)

A method as defined in claim 12, further comprising retrieving the predetermined integer-based function in response to reading the transcendental floating-point operation.

### Claim 14 (depends on 11)

A method as defined in claim 11, further comprising storing the predetermined integer-based function.

### Claim 15 (depends on 14)

A method as defined in claim 14, wherein storing the predetermined integer-based function comprises storing the predetermined integer-based function in a run-time library.

### Claim 16 (depends on 14)

A method as defined in claim 14, wherein storing the predetermined integer-based function comprises storing a hand-coded software function structured to perform the floating-point operation using no floating-point instructions.

### Claim 17 (depends on 14)

A method as defined in claim 14, wherein storing the predetermined integer-based function comprises storing at least one of an exponential function and a logarithmic function.

### Claim 18 (depends on 14)

A method as defined in claim 14, wherein storing the predetermined integer-based function comprises storing at least one of a sine function, a cosine function, a tangent function and an inverse tangent function.

### Claim 19 (depends on 14)

A method as defined in claim 14, wherein storing the predetermined integer-based function comprises storing the predetermined integer-based function using no floating-point instructions.

### Claim 20

An apparatus for compiling a transcendental floating-point operation, the apparatus comprising:
a first memory device to store a run-time library, the run-time library including a predetermined integer-based function structured to perform the transcendental floating-point operation;
a second memory device to store a plurality of source code instructions including the transcendental floating-point operation; and
a processor operatively coupled to the first memory device and the second memory device, the processor being structured to compile the plurality of source code instructions to produce an object code, the object code including instructions based on the predetermined integer-based function.

### Claim 21 (depends on 20)

An apparatus as defined in claim 20, wherein the first memory device comprises the second memory device.

### Claim 22 (depends on 20)

An apparatus as defined in claim 20, wherein the processor is structured to include instructions in the object code based on the predetermined integer-based function if a target processor does not include a native floating-point unit.

### Claim 23 (depends on 20)

An apparatus as defined in claim 20, wherein the run-time library includes a plurality of functions hand-coded to use no floating-point instructions.

### Claim 24 (depends on 23)

An apparatus as defined in claim 23, wherein the plurality of functions hand-coded to use no floating-point instructions includes an exponential function, a logarithmic function, a sine function, a cosine function, a tangent function, and an inverse tangent function.

### Claim 25

A machine readable medium storing instructions structured to cause a machine to: read a plurality of source code instructions including a transcendental floating-point operation; lookup a predetermined integer-based function structured to perform the transcendental floating-point operation; retrieve the predetermined integer-based function from a run-time library; and compile the plurality of source code instructions to produce an object code, the object code including instructions based on the predetermined integer-based function.

### Claim 26 (depends on 25)

A machine readable medium as defined in claim 25, wherein the instructions are further structured to cause the machine to read data indicating a target processor does not include a native floating-point unit.

### Claim 27 (depends on 25)

A machine readable medium as defined in claim 25, further comprising the run-time library, the run-time library including a plurality of functions to perform a plurality of transcendental floating-point operations without using floating-point instructions.

### Claim 28 (depends on 25)

A machine readable medium as defined in claim 25, wherein the instructions are further structured to cause the machine compile the plurality of source code instructions without instructions based on the predetermined integer-based function if a target processor includes a native floating-point unit.
