Hello all, I have just begun learning C and have run into a problem with floating-point numbers. I am using Dev-C++ 4.9.9.2 on Vista. I am working on this example from a book:

Code:

/* showf_pt.c -- displays float value in two ways */
#include <stdio.h>
int main(void)
{
float aboat = 32000.0;
double abet = 2.14e9;
long double dip = 5.32e-5;
printf("%f can be written %e\n", aboat, aboat);
printf("%f can be written %e\n", abet, abet);
printf("%f can be written %e\n", dip, dip);
return 0;
}

The output the book says I should get is this:

Code:

32000.000000 can be written 3.200000e+04
2140000000.000000 can be written 2.140000e+09
0.000053 can be written 5.320000e-05

But the output that I get is:

Code:

32000.000000 can be written 3.200000e+004
2140000000.000000 can be written 2.140000e+009
-1950228512509697500000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000.000000
can be written 2.725000e+002

The first two printf functions come out right, but the third one is obviously wrong. Can anyone help me figure out what is going on here? Thanks!