Work with numbers that exceed the maximum decimal value

I work with the product of the first 26 primes. This requires more than 52 bits of accuracy, which, in my opinion, are the maximum that double can handle, and more than 28-29 significant digits, which can be decimal. So, what would be the strategies for multiplying and dividing by numbers, large?

Also, what will affect the performance of any hoops that I have to jump to make this happen?

The product of the first 22 primes (the most that I can multiply by my calculator without going into scientific mode):

10,642,978,845,819,148,849,204,664,294,430

The product of the last four is

72,370,439

When multiplied together, I get:

7.7023705133964511682328635583552e+38

, , , . , , . ; ​​ , .

TIA!

PS: , , ; , , , .

+3
2

BigInteger # 4.0. , , ,

+6

, , . , , . [0..25] ints, , n- . , ; , .

, .

0

Source: https://habr.com/ru/post/1776614/


All Articles