Ruby | Math cbrt() function Last Updated : 04 Dec, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: Ruby #Ruby program for cbrt() function #Assigning values val1 = 8 val2 = 27 val3 = 64 val4 = 1000 #Prints the cbrt() value puts Math.cbrt(val1) puts Math.cbrt(val2) puts Math.cbrt(val3) puts Math.cbrt(val4) Output: 2.0 3.0000000000000004 4.0 10.0 Example 2: Ruby #Ruby program for cbrt() function #Assigning values val1 = 10 val2 = -29 val3 = 899 val4 = -87879 #Prints the cbrt() value puts Math.cbrt(val1) puts Math.cbrt(val2) puts Math.cbrt(val3) puts Math.cbrt(val4) Output: 2.1544346900318834 -3.0723168256858475 9.651316634226061 -44.45920597627334 Reference: https://devdocs.io/ruby~2.5/math#method-c-cbrt Comment More infoAdvertise with us Next Article Ruby | Math cbrt() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Collections Ruby Math-class Similar Reads Ruby | Math cos() function The cos() is an inbuilt function in Ruby returns the cosine value of a given angle expressed in radians which is in range [-inf, +inf]. The returned value is in range [-1, +1]. Syntax: Math.cos(value) Parameters: The function accepts one mandatory parameter value whose corresponding cosine value is 1 min read Ruby | Math cosh() function The cosh() is an inbuilt function in Ruby returns the hyperbolic cosine of value given in radians. The value passed is in range [-inf, +inf]. The returned value is in range [1, +inf]. Syntax: Math.cosh(value)Â Parameters: The function accepts one mandatory parameter value whose corresponding hyperbo 1 min read Ruby | Math atan() function The atan() is an inbuilt function in Ruby returns the arc tangent of a number means give a tangent value to this function it will return the angle in radian corresponding to that value. arc tangent is the inverse operation of tangent. This function accepts all numbers in range [-inf, +inf]. Syntax: 1 min read Ruby | Math frexp() function The frexp() function in Ruby returns a two-element array containing the normalized fraction which is a float value and an exponent that is an integer value of the given number. On equating, fraction ** (2 ^ exponent) gives back the number. Syntax: Math.frexp(number) Parameter: The function takes a m 1 min read Ruby | Math log() function The log() function in Ruby returns the logarithm value of X. The second parameter is the base given by the user to which the logarithm value is returned. In case its not given, then the default base is e. Syntax: Math.log(X, base) Parameter: The function takes one mandatory parameter X whose logarit 1 min read Like