Standard library / math

math.Signbit()

Reports sign bit, including negative zero. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func Signbit(x float64) bool

Parameters & Attributes

NameTypeDescription
xfloat64First input operand (or sole input if unary).

Return Value

bool

Reports sign bit, including negative zero.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math")
func main() {  fmt.Println(math.Signbit(math.Copysign(0, -1)))}
Go Reference