VOOZH about

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

⇱ Ruby | Math cosh() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Math cosh() function

Last Updated : 12 Jul, 2025

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 hyperbolic cosine value is returned. 

Return Value: It returns the hyperbolic cosine value.

Example 1

Output:

1.0
1.232972949211241
1.5430806348152437
3.7621956910836314

Example 2

Output:

3.9043355367595756e+56
1.4330863854487745
1.8189854738044024e+42
Infinity

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

Comment
Article Tags: