Spyke
lemmy.zip

Say, you have a turn-based game where units move on a grid. … Then you realize that the move finishes exactly when the position of the unit coincides with the target cell's center.

I mean, something like inbetween(target - cellRadius, target + cellRadius), no?

And of course you first (and generally) convert the floating points to units you can actually work with, why is this even a question? Anyone who knew KSP as more than a rocket explosion simulator, learned that lession long ago from the Kraken.

14

That's one case study. He lists many more where throwing an epsilon at a floating point problem is the wrong solution.

9
lemmy.world

Headline: says something. (That is obviously not true and just clickbaiting)

Instant disclaimer: the headline is not good, it should be instead "don't do this other thing".

Later in the article: how do we avoid doing the thing I told you not to do? By doing what I told you not to do.

The dude may be correct (idk, haven't bothered reading the rest of the article), but he doesn't know how to write/communicate. I don't believe he's respecting my time. Just tell in the title what you actually want to talk about.

11

I got a LITTLE bit further than you.

Boils down to "make the 'close enough' number have some real meaning in your domain instead of just picking an arbitrarily small one"

... at least to my read. Again, like you, didn't finish.

5

You reached the end

It's OK to compare floating-points for equality | Spyke