logoalt Hacker News

yorwbatoday at 10:21 AM1 replyview on HN

For x = -i, square(x) = -1, sqrt(square(x)) = i. Meanwhile, abs(x) = 1. You're right that it simplifies to abs(x) for real x, but that no longer holds for arbitrary complex values.


Replies

NooneAtAll3today at 1:12 PM

for arbitrary complex values sqrt() gives 2 answers with +- signs

so sqrt(square(-i)) = +-i, one of which is x