Standard library / reflect

reflect.Value.OverflowComplex()

Check whether the candidate complex 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) OverflowComplex(x complex128) bool

Parameters & Attributes

NameTypeDescription
xcomplex128Candidate numeric value to check against the receiver type’s range.

Return Value

bool

Check whether the candidate complex 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(complex64(0)).OverflowComplex(complex(math.MaxFloat64, 0))) }
Go Reference