Skip to content

Comment on Show HN: Online IEEE 754 playground

Comments

This isn't IEEE 754 floating point, but rather Javascript floats. For example, it gets (n!=0)/0 wrong by using the javascript NaN value instead of the IEEE 754 value of +-Infinity. For a playground like this, I think that it would be interesting to show how IEEE 754 and Javascript differ -- division by zero, the max function, etc.

Edit: I had misremembered one of the differences. Javascript does get division by zero correct. The biggest differences are in the comparisons, Javascript propagates NaNs more frequently.

Why do they even differ?

Decisions made when javascript was being written. Certain functions were decided to be more non-numeric than what the floating point spec called for.

AboutSource Built by g1lg1l

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