Learn and Learn

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

GoLang – Find Tangent – Tan() Function – Examples & Explanation

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

Syntax of Tan() Function in Go Language

The syntax of Tan() 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:
Tan(±0) = ±0
Tan(±Inf) = NaN
Tan(NaN) = NaN

 

Parameters of Tan() 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) Tan() 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 Tan() Function in Go Language

Tan() function will returns the tangent of the radian argument(x – parameter).

 

GoLang Tan() Function Example 1


Output:
-3.096323780649746

 

GoLang Tan() Function Example 2


Output:
-0.024783032802668286

 

GoLang Tan() Function Example 3


Output:
1.557407724654902

 

Loading...
LearnAndLearn.com © 2018 - All rights reserved