Multiply (Ternary): Difference between revisions
From TernaryWiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Ternary multiplication works similarly to decimal long multiplication. The multiplicand is multiplied by each digit of the multiplier, which results in a list of partial products. Each next partial product is | Ternary multiplication works similarly to decimal long multiplication. The multiplicand is multiplied by each digit of the multiplier, which results in a list of partial products. Each next partial product is shifted over by one place value. The list of partial products is then added together for the final product. | ||
The difference with ternary is the multiplicand is EORed by each | The difference with ternary is the tryte multiplicand is [[EOR (Ternary Gate)|EORed]] by each trit of the multiplier. This results in all the partial products being the A input buffered, zeroed, or [[NEG (Ternary Gate)|negated]] depending on the value of B at that digit. Each partial product is also shifted to the left. | ||
All the partial products are then added up for the final | All the partial products are then added up for the final product. | ||
== Ternary Multiplication Example == | == Ternary Multiplication Example == |
Latest revision as of 10:39, 6 August 2025
Ternary multiplication works similarly to decimal long multiplication. The multiplicand is multiplied by each digit of the multiplier, which results in a list of partial products. Each next partial product is shifted over by one place value. The list of partial products is then added together for the final product.
The difference with ternary is the tryte multiplicand is EORed by each trit of the multiplier. This results in all the partial products being the A input buffered, zeroed, or negated depending on the value of B at that digit. Each partial product is also shifted to the left.
All the partial products are then added up for the final product.
Ternary Multiplication Example
317 | 316 | 315 | 314 | 313 | 312 | 311 | 310 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 | 31 | 30 | B | A | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | - | 0 | 0 | + | - | + | - | + | = | + | EOR | + | - | 0 | 0 | + | - | + | - | + | |||||||||
+ | - | 0 | 0 | + | - | + | - | + | ↓ | = | + | ||||||||||||||||||
+ | - | 0 | 0 | + | - | + | - | + | ↓ | ↓ | = | + | |||||||||||||||||
- | + | 0 | 0 | - | + | - | + | - | ↓ | ↓ | ↓ | = | - | ||||||||||||||||
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ↓ | ↓ | ↓ | ↓ | = | 0 | |||||||||||||||
- | + | 0 | 0 | - | + | - | + | - | ↓ | ↓ | ↓ | ↓ | ↓ | = | - | ||||||||||||||
+ | - | 0 | 0 | + | - | + | - | + | ↓ | ↓ | ↓ | ↓ | ↓ | ↓ | = | + | |||||||||||||
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ↓ | ↓ | ↓ | ↓ | ↓ | ↓ | ↓ | = | 0 | ||||||||||||
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ↓ | ↓ | ↓ | ↓ | ↓ | ↓ | ↓ | ↓ | = | 0 | |||||||||||
| |||||||||||||||||||||||||||||
0 | 0 | 0 | 0 | + | + | 0 | - | + | + | 0 | 0 | + | + | + | + | 0 | + | = | 2,093,320 |