Standard library / math/big

big.Float.SetInt64()

Set from a signed 64-bit integer, rounding if destination precision is insufficient. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '-42\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Float) SetInt64(x int64) *Float

Parameters & Attributes

NameTypeDescription
xint64Numeric 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).SetInt64(-42))}
Go Reference