How to Code a Solution To Deal With Large Numbers?

2019-01-23 06:07发布

I'm doing some Project Euler problems and most of the time, the computations involve large numbers beyond int, float, double etc.

Firstly, I know that I should be looking for more efficient ways of calculation so as to avoid the large number problem. I've heard of the Bignum libraries.

But, for academics interests, I'd like to know how to code my own solution to this problem.

Can any expert please help me out? (My language is C)

7条回答
看我几分像从前
2楼-- · 2019-01-23 06:50

A popular bignum library for C/C++ is the GNU MP Bignum Library. I've used it for several Project Euler problems, but fact remains that C isn't a very suitable language for Euler-problems. If performance was more important C would have more to give, but now you're much better off using a language which built in bignum support, such as Ruby (there are lots of others).

查看更多
登录 后发表回答