1. For storing more than 6 decimal places after the decimal point?

2. For storing a number having more than 10^3 digits?

2. For storing a number having more than 10^3 digits?

Last edited on

1. double/long double. How many places they can store after the decimal point mainly depends on how many places there are before the decimal point.

2. The types provided by GMP: http://gmplib.org/

2. The types provided by GMP: http://gmplib.org/

Number one is covered by double or long double.

Number two: You could try the boost library which will do up to 300 sf, but I must ask why you want to do that?

If it is something along the lines of working out PI to 1000 digits say, then you need a different method to do this rather than a variable type.

Here is a link that show various methods of calculating pi, with varying levels of difficulty.

I am guessing why you need this - maybe you can see how it works and adapt it for your needs.

Good luck.

Number two: You could try the boost library which will do up to 300 sf, but I must ask why you want to do that?

If it is something along the lines of working out PI to 1000 digits say, then you need a different method to do this rather than a variable type.

Here is a link that show various methods of calculating pi, with varying levels of difficulty.

http://beej.us/blog/data/pi-chudnovsky-gmp/ |

I am guessing why you need this - maybe you can see how it works and adapt it for your needs.

Good luck.

Topic archived. No new replies allowed.