Standard library / math/big

big.Float.SetMantExp()

Construct mantissa times two to the exponent, adopting mantissa precision and rounding mode. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '12\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Float) SetMantExp(mant *Float, exp int) *Float

Parameters & Attributes

NameTypeDescription
mant*FloatMantissa input or output.
expintBinary exponent.

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).SetMantExp(big.NewFloat(0.75), 4))}
Go Reference