Ruby | Math tan() function Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The tan() is an inbuilt function in Ruby returns the tangent of a given angle expressed in radians which is in range [-inf, +inf]. The returned value is in range [-inf, +inf]. Syntax: Math.tan(value) Parameters: The function accepts one mandatory parameter value whose corresponding tangent value is returned. Return Value: It returns the tangent value. Example 1: CPP #Ruby program for tan() function #Assigning values val1 = 1 val2 = 0 val3 = 989 val4 = -8932 #Prints the tan() value puts Math.tan(val1) puts Math.tan(val2) puts Math.tan(val3) puts Math.tan(val4) Output: 1.5574077246549023 0.0 -0.6866146142998235 -0.48563022371184766 Example 2: CPP #Ruby program for tan() function #Assigning values val1 = -1023 val2 = 0.67 val3 = 98 val4 = -39 #Prints the tan() value puts Math.tan(val1) puts Math.tan(val2) puts Math.tan(val3) puts Math.tan(val4) Output: 2.290822861412639 0.7922541747282569 0.6998536538095259 -3.614554407101535 Reference: https://devdocs.io/ruby~2.5/math#method-c-tan Comment More infoAdvertise with us Next Article Ruby | Math tan() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Collections Ruby Math-class Similar Reads Ruby | Math tanh() function The tanh() is an inbuilt function in Ruby returns the hyperbolic tangent of value given in radians. The value passed is in range [-inf, +inf]. The returned value is in range [-1, +1]. Syntax: Math.tanh(value) Parameters: The function accepts one mandatory parameter value whose corresponding hyperbol 1 min read Ruby | Math sin() function The sin() is an inbuilt function in Ruby returns the sine of a given angle expressed in radians which is in range [-inf, +inf]. The returned value is in range [-1, +1]. Syntax: Math.sin(value) Parameters: The function accepts one mandatory parameter value whose corresponding sine is returned. Ret 1 min read Ruby | Math sinh() function The sinh() is an inbuilt function in Ruby returns the hyperbolic sine of value given in radians. The value passed is in range [-inf, +inf]. The returned value is in range [-inf, +inf]. Syntax: Math.sinh(value) Parameters: The function accepts one mandatory parameter value whose corresponding hyperbo 1 min read 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 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 Like