It's not difficult to find. Google for "printf", click on the first hit, and look at the format specifiers. "f" is for floating point numbers.
Leave out the 'l': %f.
Printable View
It's not difficult to find. Google for "printf", click on the first hit, and look at the format specifiers. "f" is for floating point numbers.
Leave out the 'l': %f.
actually, I found out where the problem is, its actually not because of %f and %lf because I tried both before posting it here, even though -Wall reveals that there are problems with lf, it would still work. The answer was that my client told me it was 14 decimal points when it is in fact 29 decimal points.
Yes, on at least on of my compilers, %lf is treated as just %f. But don't rely on that, because %lf is not part of the ANSI C standard.Quote:
even though -Wall reveals that there are problems with lf, it would still work.
Salem, does your compiler not give a warning to the effect that the variable d is used without having been initialized? That's odd. I'd think it would. Unfortunately I don't have a compiler on this computer so I can't try it out.
> does your compiler not give a warning to the effect that the variable d is used without having been initialized?
It does if I add "-O2" to the options.
That's funny. I thought that -O2 enabled optimisations, and reporting uninitialized variables would seem to be a warning. Perhaps it's a warning that can only be detected with optimisations.