Standard library / reflect

reflect.Value.Float()

Read a floating-point value as float64; other kinds panic. Expected stdout: '1.5\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) Float() float64

Return Value

float64

Read a floating-point value as float64; other kinds panic.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(reflect.ValueOf(float32(1.5)).Float()) }
Go Reference