Commit b28802d2 authored by Robert Griesemer's avatar Robert Griesemer

math/big: make ErrNaN actually implement the error interface (oversight)

There was no way to get to the error message before.

Change-Id: I4aa9d3d9f468c33f9996295bafcbed097de0389f
Reviewed-on: https://go-review.googlesource.com/8660Reviewed-by: 's avatarAlan Donovan <adonovan@google.com>
parent 514eb4aa
......@@ -71,6 +71,11 @@ type ErrNaN struct {
msg string
}
// ErrNan implements the error interface.
func (err ErrNaN) Error() string {
return err.msg
}
// NewFloat allocates and returns a new Float set to x,
// with precision 53 and rounding mode ToNearestEven.
// NewFloat panics with ErrNaN if x is a NaN.
......
......@@ -12,6 +12,9 @@ import (
"testing"
)
// Verify that ErrNaN implements the error interface.
var _ error = ErrNaN{}
func (x *Float) uint64() uint64 {
u, acc := x.Uint64()
if acc != Exact {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment