0
Square root in Ruby
How could I calculate the square root in Ruby? I've tried sqrt() and math.sqrt(), but none of them worked.
2 ответов
+ 9
You have to import CMath library .
for example:-
require 'cmath'
x = CMath.sqrt(5)
puts x
+ 2
I just figured it out: I have to write Math.sqrt, in high case. Thanks, guys.