3 ms·
Came to say "when (not) to use floats is actually the tricky part", read the article, and still say it. Not that the article is wrong, but I think that's just o
by archi42 4y ago
Came to say "when (not) to use floats is actually the tricky part", read the article, and still say it. Not that the article is wrong, but I think that's just one of the minor issues when people use floats. If engineers would only use floats once they properly understood the concepts, they'll naturally start to wonder how to properly do comparisons (especially for equality).
To illustrate, here is some gold a friend recently showed to me: `float i = 1.F; while(i <= 10.f) { do_something_important(array[(int)i]); i+= 1.f; }`. We both died a little bit (though maybe only I did, because he sees stuff like that too often).