Standard library / go/constant

go/constant.MakeFloat64()

Represent the finite float64 input, not the original decimal spelling; nonfinite inputs produce Unknown. Expected stdout: '1/2 Unknown\n'.

Formal Syntax & Structure

go syntaxgo
func MakeFloat64(x float64) Value

Parameters & Attributes

NameTypeDescription
xfloat64Input constant or Go value as specified by the function.

Return Value

Value

Represent the finite float64 input, not the original decimal spelling; nonfinite inputs produce Unknown.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/constant"  "math")
func main() {  fmt.Println(constant.MakeFloat64(0.5).ExactString(), constant.MakeFloat64(math.Inf(1)).Kind())}
Go Reference