Double precision in C++ (or pow(2, 1000))

前端 未结 7 670
情书的邮戳
情书的邮戳 2021-01-14 19:38

I\'m working on Project Euler to brush up on my C++ coding skills in preparation for the programming challenge(s) we\'ll be having this next semester (since they don\'t let

7条回答
  •  梦谈多话
    2021-01-14 20:00

    If you want to do this sort of thing on a practical basis, you're looking for an arbitrary precision arithmetic package. There are a number around, including NTL, lip, GMP, and MIRACL.

    If you're just after something for Project Euler, you can write your own code for raising to a power. The basic idea is to store your large number in quite a few small pieces, and implement your own carries, borrows, etc., between the pieces.

提交回复
热议问题