Why it is 'not equal'? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
19th Jun 2019, 8:48 AM
Pritam Kumar Das
Pritam Kumar Das - avatar
2 Answers
+ 1
u need to write f1 = 0.1f if(f1 == 0.1f)
19th Jun 2019, 8:51 AM
Cat Sauce
Cat Sauce - avatar
+ 1
It's a bit complicated, but float gets converted to double and becomes a slightly different down the line. When working with floats, add 'f' at the end of numbers, i.e.: 0.1f. That way it won't be converted back and forth and cause issues like that.
19th Jun 2019, 8:57 AM
BlazingMagpie
BlazingMagpie - avatar