I have to power nums in assembly (intel emu 8086). How can I power (Exponentiation) 2 digits nums in assembly? Must I save the result in array? What is the length of the larget possible result? (99^99) Thanks, Ori
Asked
Active
Viewed 883 times
1 Answers
1
For 99^99 the result is 3.6972963764972677265718790562881e+197.
This probably won't fit in a single 16-bit register. You need to store it in memory and implement your own special code to do things like addition and multiplication.
To store it memory as 1 decimal digit per byte (or one "base 10 digit" per byte), the result will be about 198 bytes. For better performance you can store it in memory as one "base 256 digit" per byte, where it'd only take up about 83 bytes of memory. This improves performance by doing more work per instruction.
Even better would be one "base 65536 digit" per word to do even more work for each instruction.

Brendan
- 35,656
- 2
- 39
- 66