diff options
author | Kai Backman <kaib@golang.org> | 2010-07-20 15:53:16 +0300 |
---|---|---|
committer | Kai Backman <kaib@golang.org> | 2010-07-20 15:53:16 +0300 |
commit | 36057e721e6fdc5c3dff8228c77ea36027a872c4 (patch) | |
tree | 32c7e536caa7170b5b633d8e182863f46372ee63 /test/float_lit.go | |
parent | 658d5213585d651b01b9b0e41a32b936093493d5 (diff) | |
download | go-36057e721e6fdc5c3dff8228c77ea36027a872c4.tar.gz go-36057e721e6fdc5c3dff8228c77ea36027a872c4.zip |
more soft float support. passes several basic tests
but with less precision than hardware counterparts.
fixed a number of tests to output BUG when they failed.
changed the runner to distinghuish between output
and output containing ^BUG
R=rsc
CC=dho, golang-dev
https://golang.org/cl/1778041
Diffstat (limited to 'test/float_lit.go')
-rw-r--r-- | test/float_lit.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/float_lit.go b/test/float_lit.go index 58bd4dac01..f77d24e82d 100644 --- a/test/float_lit.go +++ b/test/float_lit.go @@ -6,6 +6,20 @@ package main +import "os" + +var deLim float64 +var bad bool + +func +init() { + if os.Getenv("GOARCH") == "arm" { + deLim = 1.0e-8 + } else { + deLim = 10.e-14 + } +} + func pow10(pow int) float64 { if pow < 0 { return 1/pow10(-pow); } @@ -30,15 +44,18 @@ close(da float64, ia, ib int64, pow int) bool { de = -de; } - if de < 1.0e-14 { + if de < deLim { return true; } + if !bad { + println("BUG") + bad = true + } return false; } func main() { - if !close(0., 0, 1, 0) { print("0. is ", 0., "\n"); } if !close(+10., 10, 1, 0) { print("+10. is ", +10., "\n"); } if !close(-210., -210, 1, 0) { print("-210. is ", -210., "\n"); } |