1

In IRB (using Ruby version 2.2), if I try getting the square root of -1 by raising it to the power of 0.5, I get strange results:

(-1)**(0.5)
  => (6.123233995736766e-17+1.0i)

This looks like a really close approximation, but does anybody know where the rounding issue is coming from?

Sean Huber
  • 3,945
  • 2
  • 26
  • 31

0 Answers0