How could i print the number E to the 50th digit, currently it is only printing to the 7th digit. here is my code
Code:
#include <stdio.h>
#define MAX 30
int factorial ( int i ) ;
int main ( void )
{
double e ;
int i , j ;
for (e= 1 , i =1 ; i < MAX ; i++)
e += 1.0/(j=factorial(i));
printf("%f \n ",e);
return 0;
}
int factorial(int num)
{
if (num == 1)
return 1;
else
return num * factorial(num-1);
}
if i make the variable e to a long double i get 0.0000000 and if I increase the MAX to lets say 40 i get inf .
btw. i am using gcc 3.3.3 on fedora 2
thanks