math.Signbit() Function in Golang With Examples
Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You check whether the sign of the specified number is negative or negative zero with the help of Signbit() function provided by the math package. If the sign of the given number is negative, then this function will return true. Otherwise, return false. So, you need to add a math package in your program with the help of the import keyword to access Signbit() function.
func Signbit(x float64) bool
Result 1: true Result 2: false Result 3: true Result 4: false Result 5: false
Sign of the given number is negative