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.
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.