Skip to content

Comment on What every computer scientist should know about floating-point arithmetic (1991) [pdf]parent

Comments

The thing is that

if (f == 0.0) means "is f exactly zero so it's not initialized" 99 times for every one time it means "is f zero-ish because of a cancellation/degeneracy/whatever"

I just found that I have now annotated it for "yeah this one is ok" about 100 times, and caught zero cases where I meant to do a comparison to zero-or-very-nearly-so but accidentally wrote == 0.0.

So my conclusion is: I would have had less noise in my code with that exception in the linter, and the linter had been equally useful.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.