Re:Goodbye C++, Hello C
by bionade24 on Saturday June 26, 2021 @07:19AM
(#27640952)
The statement was made about a float pointer. Still float precision is a problem beginners run into, too. So maybe it'll will help one reading it somewhen.
float a = 0.1f * 0.1f;
assert((a - 0.01f) < 0.0001); <-- Works
assert(a == 0.01f); <-- Will fail
float a = 0.1f * 0.1f; assert((a - 0.01f) < 0.0001); <-- Works assert(a == 0.01f); <-- Will fail