aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-rw-r--r--src/math/big/float.go5
-rw-r--r--src/math/big/float_test.go3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/math/big/float.go b/src/math/big/float.go
index ed55e8e513..35ad2567e7 100644
--- a/src/math/big/float.go
+++ b/src/math/big/float.go
@@ -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.
diff --git a/src/math/big/float_test.go b/src/math/big/float_test.go
index 2a48ec4465..5b5a0247b1 100644
--- a/src/math/big/float_test.go
+++ b/src/math/big/float_test.go
@@ -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 {