Accuracy is not the problem here. It's the data type that is. Even a double (which is usually 64-bits in length), will never give you 100 decimal places (without even considering the storage method....
10^100 >
2^64,
10^100 >
2^128, and an 80-bit BCD number is capable of 20 decimal digits). Floating point numbers are usually stored in form of exponent and mantissa, but the type cannot store many digits of precision (the mantissa).
QUOTE(ajaymatrix @ 17 May, 2008 - 05:55 AM)

The program is finding the Square Root of 2 to 100 decimal places.
This is the code i wrote following Newton's Method. But 1.4142135623730951 is the value I am getting.
CODE
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
long double x=1;
for (i=0;i<30;i++) { //30 iterations
x=(x+2/x)/2;
}
cout<<setprecision(100)<<(x);
system("pause");
return 0;
}
How to improve the accuracy to 100 digits.
This post has been edited by perfectly.insane: 17 May, 2008 - 07:42 AM