VOOZH about

URL: https://www.geeksforgeeks.org/ruby/ruby-math-sqrt-function/

⇱ Ruby | Math sqrt() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Math sqrt() function

Last Updated : 12 Jul, 2025
The sqrt() is an inbuilt function in Ruby returns the square root of a given value.
Syntax: Math.sqrt(value) Parameters: The function accepts one mandatory parameter value whose square root is to be returned. Return Value: It returns the square root of the value.
Example 1: Output:
2.0
3.0
8.0
10.0
Example 2: Output:
6.324555320336759
4.358898943540674
12.806248474865697
34.64101615137755
Reference: https://devdocs.io/ruby~2.5/math#method-c-sqrt
Comment