Hacker News new | ask | show | jobs
by bionsuba 4053 days ago
To be fair, just because something is a standard doesn't mean it isn't a dumb implementation. Just by testing the programming languages on my computer, I can tell you that Python, C, and D all throw errors rather than allow it, which is the smart thing to do.
1 comments

> I can tell you that Python, C, and D all throw errors rather than allow it

Python throws an error, but numpy.divide(1., 0) will work just fine (and return inf).

I'm not sure why you're saying C throws an error. The behavior of dividing by 0 is undefined by default, but on most machines these days the hardware implements IEE-754 and the C implementation will advertise as implementing IEC 60559, so 1. / 0 will give you inf as well.

Trying to compile a test program with Clang threw errors, and bringing up numpy is disingenuous.
Are you sure you were using floating point math? Compiling 1.0 / 0.0 should not give errors or warnings. 1 / 0 will, on the other hand.