Standard library / math/big

big.Float.Sign()

Return -1, 0 or 1; both signed zeros return zero. Expected stdout: '-1 0 1\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Float) Sign() int

Return Value

int

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

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(big.NewFloat(-2).Sign(), big.NewFloat(0).Sign(), big.NewFloat(2).Sign())}
Go Reference