# US 2023/0273769 A1 · Dynamic algorithm selection

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

- Number: US 2023/0273769 A1
- Document ID: US20230273769A1
- Status: Published application
- Kind: A1
- Application number: 17/680,436
- Filed: 2022-02-25
- Published: 2023-08-31
- Earliest claimed: 2022-02-25
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Kerstin Claudia Schelm; Cedric Lichtenau; Michael Klein; Stefan Payer; Petra Leber
- Web page: https://patentgrep.com/patent/US20230273769A1

## CPC

- G06F 7/523: Multiplying only
- G06F 7/535: Dividing only
- G06F 7/4915: {Multiplying; Dividing (G06F7/492, G06F7/498 take precedence)}
- G06F 7/52: Multiplying; Dividing (G06F7/483 - G06F7/491, G06F7/544 take precedence)
- G06F 7/5443: {Sum of products (for applications thereof, see the relevant places, e.g. G06F17/10, H03H17/00)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Dynamic selection of a multiplication algorithm by receiving operands A and B, determining a difference between A and B, selecting a first multiplication algorithm if the difference falls below a threshold, selecting a second multiplication algorithm if the difference equals or exceeds the threshold, pre-scaling the operands, calculating a quotient for the scaled operands, back multiplying the quotient using the selected algorithm, yielding a product, subtracting the product from operand A, yielding a remainder, and providing the remainder as an output.

## Claims

### Claim 1

A computer implemented method for dynamic selection of a multiplication algorithm comprising:
receiving, by one or more computer processors, operands A and B;
determining, by the one or more computer processors, a difference between A and B;
selecting, by the one or more computer processors, a first multiplication algorithm if the difference falls below a threshold; and
selecting, by the one or more computer processors, a second multiplication algorithm if the difference equals or exceeds the threshold.

### Claim 2 (depends on 1)

The computer implemented method according to claim 1, wherein determining the difference between A and B comprises:
determining, by the one or more computer processors, a difference between a number of leading zeros for B minus a number of leading zeros for A.

### Claim 3 (depends on 1)

The computer implemented method according to claim 1, wherein the threshold is four.

### Claim 4 (depends on 1)

The computer implemented method according to claim 1, wherein the first algorithm comprises digit wise multiplication and continuous summing of partial products.

### Claim 5 (depends on 1)

The computer implemented method according to claim 1, wherein the second algorithm comprises multi-digit multiplication in combination with a decimal reduction tree.

### Claim 6 (depends on 1)

The computer implemented method according to claim 1, further comprising calculating, by the one or more computer processors, the quotient of A and B; and back multiplying, by the one or more computer processors, the quotient and B using the first algorithm or the second algorithm according to the difference; determining, by the one or more computer processors, a second difference between the product of the quotient and B from A; and providing, by the one or more computer processors, the second difference as an output.

### Claim 7

A computer program product for dynamic selection of a multiplication algorithm, the computer program product comprising one or more computer readable storage devices and collectively stored program instructions on the one or more computer readable storage devices, that when executed cause a processor to:
receive operands A and B;
determine a difference between A and B;
estimate a number of quotient digits according to the difference between A and B;
select a first multiplication algorithm if the difference falls below a threshold; and
select a second multiplication algorithm if the difference equals or exceeds the threshold.

### Claim 8 (depends on 7)

The computer program product according to claim 7, wherein determining the difference between A and B comprises:
determining a difference between a number of leading zeros for B minus a number of leading zeros for A.

### Claim 9 (depends on 7)

The computer program product according to claim 7, wherein the threshold is four.

### Claim 10 (depends on 7)

The computer program product according to claim 7, wherein the first algorithm comprises digit wise multiplication and continuous summing of partial products.

### Claim 11 (depends on 7)

The computer program product according to claim 7, wherein the second algorithm comprises multi-digit multiplication in combination with a decimal reduction tree.

### Claim 12 (depends on 7)

The computer program product according to claim 7, the stored program instructions further causing the processor to calculate a quotient of A and B; and back multiply the quotient and B using the first algorithm or the second algorithm according to the difference; determine a second difference between the product of the quotient and B from A; and provide the second difference as an output.

### Claim 13

A computer system for dynamic selection of a multiplication algorithm, the computer system comprising:
one or more computer processors;
one or more computer readable storage devices; and
stored program instructions on the one or more computer readable storage devices, which when executed cause the one or more computer processors to:
receive operands A and B;
determine a difference between A and B;
estimate a number of quotient digits according to the difference between A and B;
select a first multiplication algorithm if the difference falls below a threshold; and
select a second multiplication algorithm if the difference equals or exceeds the threshold.

### Claim 14 (depends on 13)

The computer system according to claim 13, wherein determining the difference between A and B comprises:
determining a difference between a number of leading zeros for B minus a number of leading zeros for A.

### Claim 15 (depends on 13)

The computer system according to claim 13, wherein the threshold is four.

### Claim 16 (depends on 13)

The computer system according to claim 13, wherein the first algorithm comprises digit wise multiplication and continuous summing of partial products.

### Claim 17 (depends on 13)

The computer system according to claim 13, wherein the second algorithm comprises multi-digit multiplication in combination with a decimal reduction tree.

### Claim 18 (depends on 13)

The computer system according to claim 13, the stored program instructions further causing the processor to calculate a quotient of A and B; back multiply the quotient and B using the first algorithm or the second algorithm according to the difference; determine a second difference between the product of the quotient and B from A; and provide the second difference as an output.

### Claim 19

A computer implemented method for dynamic selection of a multiplication algorithm comprising:
receiving operands A and B;
determining a difference between A and B;
estimating a number of quotient digits according to the difference between A and B;
selecting a first multiplication algorithm if the estimated number of quotient digits falls below a threshold; and
selecting a second multiplication algorithm if the estimated number of quotient digits equals or exceeds the threshold.

### Claim 20 (depends on 19)

The computer implemented method according to claim 19, wherein determining the difference between A and B comprises:
determining a difference between a number of leading zeros for B minus a number of leading zeros for A.

### Claim 21 (depends on 19)

The computer implemented method according to claim 19, wherein the first algorithm comprises digit wise multiplication and continuous summing of partial products.

### Claim 22 (depends on 19)

The computer implemented method according to claim 19, wherein the second algorithm comprises multi-digit multiplication in combination with a decimal reduction tree.

### Claim 23

A computer implemented method for dynamic selection of a multiplication algorithm comprising:
receiving operands A and B;
determining a difference between A and B;
selecting a first multiplication algorithm if the difference falls below a threshold;
selecting a second multiplication algorithm if the difference equals or exceeds the threshold;
pre-scaling the operands;
calculating a quotient for the operands;
back multiplying the quotient and operand B, using the selected algorithm, yielding a product;
subtracting the product from operand A, yielding a remainder; and
providing the remainder as an output.

### Claim 24 (depends on 23)

The computer implemented method according to claim 23, wherein determining the difference between A and B comprises:
determining a difference between a number of leading zeros for B minus a number of leading zeros for A.

### Claim 25 (depends on 23)

The computer implemented method according to claim 23, wherein the threshold is four.
