Standard library / go/constant
go/constant.ToFloat()
Convert a representable numeric constant to Float, otherwise Unknown. Expected stdout: 'Float\n'.
Formal Syntax & Structure
go syntaxgo
func ToFloat(x Value) ValueParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | Value | Input constant or Go value as specified by the function. |
Return Value
Value
Convert a representable numeric constant to Float, otherwise Unknown.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/constant")
func main() { fmt.Println(constant.ToFloat(constant.MakeInt64(42)).Kind()) }