diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
| commit | 505c19580e0f43fe5224431459cacb7c21edd93d (patch) | |
| tree | 79e2634c253d60afc0cc0b2f510dc7dcbb48497b /src/pkg/math/nextafter.go | |
| parent | 1336a7c91e596c423a49d1194ea42d98bca0d958 (diff) | |
| download | golang-505c19580e0f43fe5224431459cacb7c21edd93d.tar.gz | |
Imported Upstream version 1upstream/1
Diffstat (limited to 'src/pkg/math/nextafter.go')
| -rw-r--r-- | src/pkg/math/nextafter.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/pkg/math/nextafter.go b/src/pkg/math/nextafter.go index 86114340c..7c4b5bcdf 100644 --- a/src/pkg/math/nextafter.go +++ b/src/pkg/math/nextafter.go @@ -8,13 +8,11 @@ package math // If x == y, then x is returned. // // Special cases are: -// Nextafter(NaN, y) = NaN -// Nextafter(x, NaN) = NaN +// Nextafter(NaN, y) = NaN +// Nextafter(x, NaN) = NaN func Nextafter(x, y float64) (r float64) { - // TODO(rsc): Remove manual inlining of IsNaN - // when compiler does it for us switch { - case x != x || y != y: // IsNaN(x) || IsNaN(y): // special case + case IsNaN(x) || IsNaN(y): // special case r = NaN() case x == y: r = x @@ -25,5 +23,5 @@ func Nextafter(x, y float64) (r float64) { default: r = Float64frombits(Float64bits(x) - 1) } - return r + return } |
