How to use 12 digit number in C?

DesperateCoders picture DesperateCoders · Aug 13, 2010 · Viewed 16.5k times · Source

I am dealing with a math example. I need to use 12 digit number for my code. So which datatype should i use, to use the number in my functions?

Answer

paxdiablo picture paxdiablo · Aug 13, 2010

If you have a 64-bit integer type, I'd go with that, since it gives you the (18 full digits) range:

−9,223,372,036,854,775,808 to
+9,223,372,036,854,775,807

For other tasks (even bigger integers or massive floating point values), I use GMP, the GNU multi-precision library. It's performance is impressive.