diff options
author | Russ Cox <rsc@golang.org> | 2009-11-15 17:24:14 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-11-15 17:24:14 -0800 |
commit | ef46a9ddacb25bc9155c1dcb74e61995b2e3dc39 (patch) | |
tree | 3f13b8854fd0f1cfae092fa40100440e93b3b3c1 /test/float_lit.go | |
parent | 391e082ca9176f05be96a8853cc2bf9d93771756 (diff) | |
download | go-ef46a9ddacb25bc9155c1dcb74e61995b2e3dc39.tar.gz go-ef46a9ddacb25bc9155c1dcb74e61995b2e3dc39.zip |
gc: fix up floating point NaN comparisons
Fixes #167.
R=ken2
https://golang.org/cl/155062
Diffstat (limited to 'test/float_lit.go')
-rw-r--r-- | test/float_lit.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/float_lit.go b/test/float_lit.go index a78a6e9245..be4460e43e 100644 --- a/test/float_lit.go +++ b/test/float_lit.go @@ -20,8 +20,8 @@ close(da float64, ia, ib int64, pow int) bool db := float64(ia) / float64(ib); db *= pow10(pow); - if da == 0 { - if db == 0 { + if da == 0 || db == 0 { + if da == 0 && db == 0 { return true; } return false; @@ -59,8 +59,8 @@ main() if !close(-210e3, -210, 1, 3) { print("-210e3 is ", -210e3, "\n"); } if !close(0E-1, 0, 1, 0) { print("0E-1 is ", 0E-1, "\n"); } - if !close(+0e23, 0, 1, 23) { print("+0e23 is ", +0e23, "\n"); } - if !close(-0e345, 0, 1, 345) { print("-0e345 is ", -0e345, "\n"); } + if !close(+0e23, 0, 1, 1) { print("+0e23 is ", +0e23, "\n"); } + if !close(-0e345, 0, 1, 1) { print("-0e345 is ", -0e345, "\n"); } if !close(0E1, 0, 1, 1) { print("0E1 is ", 0E1, "\n"); } if !close(+10e23, 10, 1, 23) { print("+10e23 is ", +10e23, "\n"); } |