summaryrefslogtreecommitdiff
path: root/test/float_lit.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/float_lit.go')
-rw-r--r--test/float_lit.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/test/float_lit.go b/test/float_lit.go
index b43ae58cc..e5e95e68e 100644
--- a/test/float_lit.go
+++ b/test/float_lit.go
@@ -18,7 +18,7 @@ func
close(da double, ia, ib int64, pow int) bool
{
db := double(ia) / double(ib);
- db = db*pow10(pow);
+ db *= pow10(pow);
if da == 0 {
if db == 0 {
@@ -27,17 +27,12 @@ close(da double, ia, ib int64, pow int) bool
return false;
}
- dd := da-db;
- if dd < 0 {
- dd = -dd;
- }
-
- de := da;
+ de := (da-db) /da;
if de < 0 {
de = -de;
}
- if de*1.0e-14 > dd {
+ if de < 1.0e-14 {
return true;
}
return false;