# Floating point #'s, why so much talk about it?

• 09-20-2005
scuzzo84
Floating point #'s, why so much talk about it?
I dont get why floating points are such a big deal in C, as I am reading my C book and it seems like they put a lot of emphasis on floating point. But all that I get is that floating point #'s are basically decimal #'s. What more is to say about it?
• 09-20-2005
Ancient Dragon
On many computers that use IEEE floating point standards, floats and doubles are inaccurate. Many floats cannot be represented accurately, and compring two floats (or double) for equality may fail when logic says they should be the same. Higher-level mathametical problems will have more use for floats/doubles than you find in most "normal" applicaton programs.
• 09-20-2005
Rashakil Fol
Basically, the point is, don't think "floating point number." Think "floating point approximation."
• 09-20-2005
scuzzo84
Thanks, I am reading a nice wikipedia article on floating point right now. Quick question why does it not print "10.2" but "10.200000"

Code:

```#include <stdio.h> int main(void) { float value = 10.2; printf("The number is %f\n", value); return 0; }```
• 09-20-2005
Dave_Sinkula
>Quick question why does it not print "10.2" but "10.200000"
http://dev.unicals.com/c89-draft.html#4.9.6.1
Quote:

f The double argument is converted to decimal notation in the style [-]ddd.ddd , where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is explicitly zero, no decimal-point character appears. If a decimal-point character appears, at least one digit appears before it. The value is rounded to the appropriate number of digits.
• 09-20-2005
scuzzo84
thanks mate