Standard library / math/big

big.Float.Neg()

Negate the sign, rounding to destination precision if necessary. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '-1.25\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Float) Neg(x *Float) *Float

Parameters & Attributes

NameTypeDescription
x*FloatNumeric operand supplied to this method.

Return Value

*Float

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(new(big.Float).Neg(big.NewFloat(1.25)))}
Go Reference