Standard library / math/big

big.ErrNaN.Error()

Return the diagnostic for an invalid Float operation. Recover only at a boundary that can handle the failed computation. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (err ErrNaN) Error() string

Return Value

string

Returns the result described above; see the example for the observed behavior.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  func() {    defer func() {      if e, ok := recover().(big.ErrNaN); ok {        fmt.Println(e.Error() != "")      } else {        panic("unexpected panic")      }    }()    new(big.Float).Quo(big.NewFloat(0), big.NewFloat(0))  }()}
Go Reference