Hacker News new | ask | show | jobs
by contravariant 7 days ago
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.

2 comments

Why not −0i?
Because i is not a meaningful concept in floating point numbers.
It's customary to use the branch cut where sqrt(-1) = i.

Honestly it doesn't really matter but that's because you can't actually tell i and -i apart.

Next time we revise the floating point standard, we should add an "i bit" :)