Large Datatype

Does a datatype exist in C++ which can store the value of 100^100 ??

I find it a big limitation in C++..the inability to store large values by variables !!!

Your Suggestions will be duly respected and entertained.
Use an arbitrary precision library, like GMP. It should handle "unlimited" large values, assuming you have enough memory.
http://www.gmplib.org/
Last edited on
Try linux :D

There are 2 commands in most linux shells that can do large arithemetic like that. bc and dc

$ echo '100^100' | bc | tr -d '\\ '
10000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000


$ echo '100 100 ^ p' | dc | tr -d '\\ '
100000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000


$ echo '2^1000' | bc | tr -d '\\ '
10715086071862673209484250490600018105614048117055336074437503883703
51051124936122493198378815695858127594672917553146825187145285692314
04359845775746985748039345677748242309854210746050623711418779541821
53046474983581941267398767559165543946077062914571196477686542167660
429831652624386837205668069376
Last edited on
Topic archived. No new replies allowed.