Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

GoLang – Find Hyperbolic Cosine – Cosh() Function – Examples & Explanation

Cosh() function is used to find the hyperbolic cosine of the given input (x – parameter) in Go language. The standard math package of Go programming language has Cosh() function.

Syntax of Cosh() Function in Go Language

The syntax of Cosh() function in Go Language is:

Note: float64 is a data type in Go language which has IEEE-754 64-bit floating-point numbers.
Special cases are:
Cosh(±0) = 1
Cosh(±Inf) = +Inf
Cosh(NaN) = NaN

 

Parameters of Cosh() Function in Go Language

x – Where x is any Valid float64 Input value. This parameter is required.

 

Error Handling

If the x parameter is not a number (numeric value) Cosh() function returns an error .
If there is no argument (x – input value) passes to the function, then the compiler will produce an error.

 

Return Value of Cosh() Function in Go Language

Cosh() functireturn returns the hyperbolic cosine of the given input(x – parameters).

 

GoLang Cosh() Function Example 1


Output:
4051.5420254925943

 

GoLang Cosh() Function Example 2


Output:
1

 

GoLang Cosh() Function Example 3


Output:
1.5430806348152437

 

LearnAndLearn.com © 2018 - All rights reserved