[c] scanf and floats
I am using scanf to enter a float as follows:
float paymentAmount = 0.0;
(void) scanf ("%f", &paymentAmount);
When I enter a value such as 13.46 the standard printf shows something like 13.46000000
but if I set the printf to show more places it turns out that the stored number is really 13.4600000012343542....
this is throwing off my calculations..
Any suggestions as to why those random numbers are at the end of my float?
__________________
"Good artists copy, great artists steal." - Pablo Picasso
|