Skip to content

Comment on An Interview with the Old Man of Floating-Point (1998)parent

Comments

They don't have to share the same label. 64 bit floating points have 2^52 different NaN values. Even Float16 has 1024 which should be more than enough for all the indeterminent forms.

Collisions will come up. If you have some allocator for NaN, it will have to start reusing values. The allocator could be inefficient. How do you handle threads? Does each thread have its own NaN-allocating counter? What if threads communicate numeric results to each other and have NaN-counters close in value?

The underlying problem is that a system of calculation which propagates error symbols up the expression tree to indicate error is mixed with a system of Boolean calculation which has no such symbol. The bad calculation bubbles up a NaN up to the level of the comparison. There, the not-a-number gets eaten and becomes a Boolean true or false --- rather than becoming not-a-truth and continuing to bubble up.

There is no satisfactory way to plug NaNs into an expression that produces a clean two-valued Boolean truth with no error indication. You must separately test for the NaN.

AboutSource Built by g1lg1l

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