logoalt Hacker News

setopt • yesterday at 9:02 PM • 1 reply • view on HN

Wait, sqrt(-0) is defined as -0 and not +0? Isn’t that surprising behavior?


Replies

contravariant • yesterday at 9:52 PM

I mean either way sqrt(-0)^2 fails to equal -0, so both option are annoying.

The real answer would be something like 0i, but that's not available.

➕ show 1 reply