# US 2023/0273768 A1 · Floating-point calculation method and associated arithmetic unit

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

- Number: US 2023/0273768 A1
- Document ID: US20230273768A1
- Status: Published application
- Kind: A1
- Application number: 18/104,311
- Filed: 2023-02-01
- Published: 2023-08-31
- Earliest claimed: 2022-02-02
- Assignees: National Tsing Hua University
- Applicants: National Tsing Hua University
- Inventors: Jun-Shen Wu; Ren-Shuo Liu
- Web page: https://patentgrep.com/patent/US20230273768A1

## CPC

- G06F 7/4876: {Multiplying}
- 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: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A floating-point number operation method applied to multiplication operation of a first floating-point number and a second floating-point number is provided. The first floating point number includes a first symbol, a first exponent and a first mantissa. The second floating point number includes a second symbol, a second exponent and a second mantissa. The method includes using an arithmetic unit to perform: comparing the first exponent to an exponent threshold, wherein when the first exponent is not less than the exponent threshold, generating a mantissa operation result by multiplying the first mantissa and the second mantissa when the first exponent is not less than the exponent threshold value; and generating a calculated floating point number according to the mantissa operation result and an exponent operation result of the first exponent and the second exponent.

## Claims

### Claim 1

A floating-point calculation method applicable to multiplication between a first register and a second register, wherein the first register stores a first floating point number, and the second register stores a second floating point number; the first register comprises a first exponent bit(s) storing a first exponent, and a first mantissa bit(s) storing a first mantissa; the second register comprises a second exponent bit(s) storing a second exponent, and a second mantissa bit(s) storing a second mantissa; and the method comprises using an arithmetic unit to perform following steps:
comparing the first exponent with an exponent threshold, wherein when the first exponent is not smaller than the exponent threshold, the first mantissa is multiplied by the second mantissa to generate a mantissa operation result; and when the first exponent is smaller than the exponent threshold, the first mantissa is multiplied by the second mantissa after at least one bit of the first mantissa is discarded, to generate the mantissa operation result;
adding the first exponent to the second exponent to generate an exponent operation result; and
generating a calculated floating point number according to the mantissa operation result and the exponent operation result.

### Claim 2 (depends on 1)

The floating-point calculation method according to claim 1, wherein the first register further comprises a first sign bit storing a first sign, the second register further comprises a second sign bit storing a second sign, and the floating-point calculation method further comprises:
performing an XOR operation upon the first sign and the second sign to generate a sign operation result; and
generating the calculated floating point number according to the mantissa operation result, the sign operation result and the exponent operation result.

### Claim 3 (depends on 1)

The floating-point calculation method according to claim 1, wherein the exponent threshold is stored in a third register, and the arithmetic unit accesses the third register when performing multiplication between the first register and the second register.

### Claim 4 (depends on 1)

The floating-point calculation method according to claim 1, wherein when the first exponent is smaller than the exponent threshold, at least one bit of the first mantissa is temporarily stored without involving in arithmetic operations.

### Claim 5 (depends on 4)

The floating-point calculation method according to claim 4, wherein the exponent threshold is dynamically adjustable.

### Claim 6 (depends on 5)

The floating-point calculation method according to claim 5, wherein the exponent threshold is dynamically adjusted according to temperature of the arithmetic unit and/or types of tasks to be processed by the arithmetic unit.

### Claim 7 (depends on 4)

The floating-point calculation method according to claim 4, wherein the exponent threshold is within a dynamically adjustable range, and the arithmetic unit starts training with an exponent threshold with a value of 1; the arithmetic unit determines a criteria whether an operation precision is higher than an precision threshold;
if the criteria is met, the value of the exponent threshold is increased until the operation precision is not higher than an precision threshold, and the dynamically adjustable range comprises the exponent threshold(s) that meets the criteria.

### Claim 8 (depends on 1)

The floating-point calculation method according to claim 1, wherein the first register is coupled to a memory arranged to store the first exponent, and when the first exponent is smaller than the exponent threshold, at least one bit of the first mantissa is discarded without being stored in the memory.

### Claim 9 (depends on 1)

The floating-point calculation method according to claim 1, wherein when the first exponent is smaller than the exponent threshold, at least one bit of the first mantissa is in a Don’t Care state.

### Claim 10 (depends on 1)

The floating-point calculation method according to claim 1, wherein when the first exponent is smaller than the exponent threshold, the first floating point number is decoded into (-1)Sign1 × 2Exponent1, where Sign1 denotes the first sign, and Exponent1 denotes the first exponent.

### Claim 11 (depends on 10)

The floating-point calculation method according to claim 10, wherein when the second exponent is smaller than the exponent threshold, the second floating point number is decoded into (-1)Sign2 × 2Exponent2, where Sign2 denotes the second sign, and Exponent2 denotes the second exponent.

### Claim 12 (depends on 1)

The floating-point calculation method according to claim 1, further comprising accessing a memory using the arithmetic unit, wherein the memory stores a plurality of groups of batch normalization coefficients corresponding to a plurality of candidate thresholds respectively, and the exponent threshold is selected from one of the candidate thresholds.

### Claim 13

An arithmetic unit coupled to a first register and a second register,
wherein the first register stores a first floating point number, and the second register stores a second floating point number; the first register comprises a first exponent bit(s) storing a first exponent, and a first mantissa bit(s) storing a first mantissa; the second register comprises a second exponent bit(s) storing a second exponent, and a second mantissa bit(s) storing a second mantissa;
and when performing multiplication between the first register and the second register, the arithmetic unit performs following steps:
comparing the first exponent with an exponent threshold, wherein when the first exponent is not smaller than the exponent threshold, the first mantissa is multiplied by the second mantissa to generate a mantissa operation result; and when the first exponent is smaller than the exponent threshold, the first mantissa is multiplied by the second mantissa after at least one bit of the first mantissa is discarded to generate the mantissa operation result;
adding the first exponent to the second exponent to generate an exponent operation result; and
generating a calculated floating point number according to the mantissa operation result and the exponent operation result.

### Claim 14 (depends on 13)

The arithmetic unit according to claim 13, wherein the first register further comprises a first sign bit storing a first sign; the second register further comprises a second sign bit storing a second sign, and the arithmetic unit further performs following steps:
performing an XOR operation upon the first sign and the second sign to generate a sign operation result; and
generating the calculated floating point number according to the mantissa operation result, the sign operation result and the exponent operation result.

### Claim 15 (depends on 13)

The arithmetic unit according to claim 13, wherein the exponent threshold is stored in a third register, and the arithmetic unit accesses the third register when performing multiplication between the first register and the second register.

### Claim 16 (depends on 13)

The arithmetic unit according to claim 13, wherein when the first exponent is smaller than the exponent threshold, at least one bit of the first mantissa is temporarily stored without involving in any arithmetic operations.

### Claim 17 (depends on 16)

The arithmetic unit of claim 16, wherein the exponent threshold is dynamically adjustable.

### Claim 18 (depends on 17)

The arithmetic unit according to claim 17, wherein the exponent threshold is dynamically adjusted according to temperature of the arithmetic unit and/or types of tasks to be processed by the arithmetic unit.

### Claim 19 (depends on 16)

The arithmetic unit according to claim 16, wherein the exponent threshold is in a dynamically adjustable range, the arithmetic unit performs training with an exponent threshold with a value of 1; and the arithmetic unit determines a criteria whether the operation precision is higher than an precision threshold, and if the criteria is met, the value of the exponent threshold is increased until the operation precision is not higher than an precision threshold, and the dynamically adjustable range comprises the exponent threshold(s) that meets the criteria.

### Claim 20 (depends on 13)

The arithmetic unit of claim 13, wherein when the first exponent is smaller than the exponent threshold, the first floating point number is decoded into (-1)Sign1 × 2Exponent1, where Sign1 denotes the first sign, and Exponent1 denotes the first exponent.

### Claim 21 (depends on 20)

The arithmetic unit according to claim 20, wherein when the second exponent is smaller than the exponent threshold, the second floating point number is decoded into (-1)Sign2 × 2Exponent2, where Sign2 denotes the second sign, and Exponent2 denotes the second exponent.

### Claim 22 (depends on 13)

The arithmetic unit according to claim 13, wherein the first register and the second register are coupled to a memory arranged to store a plurality of sets of batch normalization coefficients corresponding to a plurality of candidate thresholds respectively, and the exponent threshold is selected from one of the candidate thresholds.

### Claim 23

An arithmetic device comprising a first register, a second register and an arithmetic unit, wherein the arithmetic unit is coupled to the first register and the second register, and the first register stores a first floating point number and the second register stores a second floating point number; the first register comprises a first exponent bit(s) storing a first exponent, and a first mantissa bit(s) storing a first mantissa; the second register comprises a second exponent bit(s) storing a second exponent, and a second mantissa bit(s) storing a second mantissa; wherein when performing multiplication between the first register and the second register, the arithmetic unit performs following steps:
comparing the first exponent with an exponent threshold, wherein when the first exponent is not smaller than the exponent threshold, the first mantissa is multiplied by the second mantissa to generate a mantissa operation result; when the first exponent is smaller than the exponent threshold, the first mantissa is multiplied by the second mantissa after at least one bit of the first mantissa is discarded, to generate the mantissa operation result;
adding the first exponent to the second exponent to generate an exponent operation result; and
generating a calculated floating point number according to the mantissa operation result and the exponent operation result.
