VOOZH about

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

⇱ Ruby | Math cbrt() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Math cbrt() function

Last Updated : 12 Jul, 2025

The cbrt() is an inbuilt function in Ruby returns the cube root of a given value. 

Syntax: Math.cbrt(value) 

Parameters: The function accepts one mandatory parameter value whose cuberoot is to be returned. 

Return Value: It returns the cuberoot of the value.

Example 1

Output

2.0
3.0000000000000004
4.0
10.0


Example 2

Output:  

2.1544346900318834
-3.0723168256858475
9.651316634226061
-44.45920597627334


Reference: https://devdocs.io/ruby~2.5/math#method-c-cbrt
 

Comment