aboutsummaryrefslogtreecommitdiff
path: root/test/zerodivide.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-06-18 15:46:00 -0700
committerRuss Cox <rsc@golang.org>2010-06-18 15:46:00 -0700
commit21ff75bc0efc34675775168ccae118cd286f904c (patch)
tree40872ae2605d1035840d074ff7d6c1418b9113c4 /test/zerodivide.go
parent99b23a1e5bba7c02184e7875789e25bac21e153b (diff)
downloadgo-21ff75bc0efc34675775168ccae118cd286f904c.tar.gz
go-21ff75bc0efc34675775168ccae118cd286f904c.zip
complex divide: match C99 implementation
R=iant, ken2, r, r2, ken3 CC=golang-dev https://golang.org/cl/1686044
Diffstat (limited to 'test/zerodivide.go')
-rw-r--r--test/zerodivide.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/zerodivide.go b/test/zerodivide.go
index 948aedd930..ce0fc82c89 100644
--- a/test/zerodivide.go
+++ b/test/zerodivide.go
@@ -114,16 +114,15 @@ func error(fn func()) (error string) {
}
type FloatTest struct{
- name string
f, g float64
out float64
}
var floatTests = []FloatTest{
- FloatTest{"float64 0/0", 0, 0, nan },
- FloatTest{"float64 nan/0", nan, 0, nan },
- FloatTest{"float64 inf/0", inf, 0, inf },
- FloatTest{"float64 -inf/0", negInf, 0, negInf },
+ FloatTest{0, 0, nan},
+ FloatTest{nan, 0, nan},
+ FloatTest{inf, 0, inf},
+ FloatTest{negInf, 0, negInf},
}
func alike(a, b float64) bool {
@@ -138,6 +137,9 @@ func alike(a, b float64) bool {
func main() {
for _, t := range errorTests {
+ if t.err != "" && syscall.OS == "nacl" {
+ continue
+ }
err := error(t.fn)
switch {
case t.err == "" && err == "":
@@ -158,7 +160,7 @@ func main() {
for _, t := range floatTests {
x := t.f/t.g
if !alike(x, t.out) {
- fmt.Printf("%s: expected %g error; got %g\n", t.name, t.out, x)
+ fmt.Printf("%v/%v: expected %g error; got %g\n", t.f, t.g, t.out, x)
}
}
}