Windows and GCC
I am trying to run the fibonacci sequence via the following code:
#include <stdio.h>
#include <float.h>
int main()
{
float x;
float y;
int lim44;
printf( "Enter the number of cycles: ");
scanf( "%d", &lim44);
x = 1.0;
y = 1.0;
do {
/* "Hello, world!" is printed at least one time
even though the condition is false*/
printf( "%32.1Lf\n", x );
x = x+y;
lim44 = lim44-1;
printf( "%32.1Lf\n", y);
y = y+x;
lim44 = lim44-1;
} while ( lim44 > 0 );
getchar();
}
However, it outputs zeros after the first 16 digits, making the results inaccurate. I have used double, as well as long long type settings, with the same results in that i cannot even achieve the 100th iteration without the output failing. Does anyone have any advice?