GoLang – Find Sine – Sin() Function – Examples & Explanation

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

Syntax of Sin() Function in Go Language

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


Parameters of Sin() Function in Go Language

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


Error Handling

If the x parameter is not a number (numeric value) Sin() 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 Sin() Function in Go Language

Sin() function will return the sine of the given input(x – parameter).


GoLang Sin() Function Example 1



GoLang Sin() Function Example 2



GoLang Sin() Function Example 3