Standard library / reflect
reflect.Value.OverflowFloat()
Check whether the candidate float value exceeds the represented numeric type’s range; does not detect every precision loss. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) OverflowFloat(x float64) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | float64 | Candidate numeric value to check against the receiver type’s range. |
Return Value
bool
Check whether the candidate float value exceeds the represented numeric type’s range; does not detect every precision loss.
Working Example
Example Snippetgo
package main
import ( "fmt" "math" "reflect")
func main() { fmt.Println(reflect.ValueOf(float32(0)).OverflowFloat(math.MaxFloat64)) }