Hi
the followiing code is giving 1 as answer but answer should be 0 ...becoz 0.7 is not grater than 0.7
please tell me the reasonCode:int main() { float a=0.7; printf("%d",(0.7>a)); }
Hi
the followiing code is giving 1 as answer but answer should be 0 ...becoz 0.7 is not grater than 0.7
please tell me the reasonCode:int main() { float a=0.7; printf("%d",(0.7>a)); }
It's due to the way the numbers are stored. 0.7 cannot be accurately stored, only approximated, with a float. However, when you compare it to the other 0.7, you're likely comparing a float (a) to a double (0.7). The double has more accuracy, and can store a value that is more accurate (and apperanly larger) than a.
If you change "float" to "double", your comparison will probably fail.
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
thanks for your information
Interesting...
http://cboard.cprogramming.com/showt...ight=float+0.7
http://cboard.cprogramming.com/showt...ight=float+0.7
You're all using the same constant.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.