aboutsummaryrefslogtreecommitdiff
path: root/test/literal.go
diff options
context:
space:
mode:
authorKai Backman <kaib@golang.org>2010-07-28 15:58:35 +0300
committerKai Backman <kaib@golang.org>2010-07-28 15:58:35 +0300
commitfa4da33315be8fce7663d23970a3a1d66a74ce83 (patch)
tree0abd59bf2b5ec8028cf3bf66a3534138bed55d99 /test/literal.go
parentf930d281645566a254e22181a62844fac238ce87 (diff)
downloadgo-fa4da33315be8fce7663d23970a3a1d66a74ce83.tar.gz
go-fa4da33315be8fce7663d23970a3a1d66a74ce83.zip
arm: minor bugfixes.
R=rsc CC=golang-dev https://golang.org/cl/1692057
Diffstat (limited to 'test/literal.go')
-rw-r--r--test/literal.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/literal.go b/test/literal.go
index bd231eae22..b1e1626bac 100644
--- a/test/literal.go
+++ b/test/literal.go
@@ -6,6 +6,8 @@
package main
+import "os"
+
var nbad int
func assert(cond bool, msg string) {
@@ -18,6 +20,19 @@ func assert(cond bool, msg string) {
}
}
+func equal(a, b float) bool {
+ if os.Getenv("GOARCH") != "arm" {
+ return a == b
+ }
+ d := a-b
+ if a > b {
+ return d < a * 1.0e-7
+ }
+ d = -d
+ return d < b * 1.0e-7
+}
+
+
func main() {
// bool
var t bool = true;
@@ -134,12 +149,12 @@ func main() {
assert(f04 == f05, "f04");
assert(f05 == f06, "f05");
assert(f07 == -f08, "f07");
- assert(f09 == 1/f10, "f09");
+ assert(equal(f09, 1/f10), "f09");
assert(f11 == f09, "f11");
assert(f12 == f10, "f12");
- assert(f13 == f09/10.0, "f13");
- assert(f14 == f12/10.0, "f14");
- assert(f15 == f16/1e20, "f15");
+ assert(equal(f13, f09/10.0), "f13");
+ assert(equal(f14, f12/10.0), "f14");
+ assert(equal(f15, f16/1e20), "f15");
// character
var c0 uint8 = 'a';