Standard library / math/big

big.Float.Signbit()

Distinguish negative values and negative zero from nonnegative values. Expected stdout: '0 true\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Float) Signbit() bool

Return Value

bool

Returns the result described above; see the example for the observed behavior.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  z := new(big.Float).Neg(big.NewFloat(0))  fmt.Println(z.Sign(), z.Signbit())}
Go Reference