aboutsummaryrefslogtreecommitdiff
path: root/test/float_lit.go
diff options
context:
space:
mode:
authorKen Thompson <ken@golang.org>2008-06-12 21:48:56 -0700
committerKen Thompson <ken@golang.org>2008-06-12 21:48:56 -0700
commit343f5aa7b4e11a8c0cb987fd7f7e9cbd66127c04 (patch)
treecee9dc10714116e5f3d3402d7cec03f4fe764079 /test/float_lit.go
parent67e141b637621d20cdb12b27cb63f0e74c9022cb (diff)
downloadgo-343f5aa7b4e11a8c0cb987fd7f7e9cbd66127c04.tar.gz
go-343f5aa7b4e11a8c0cb987fd7f7e9cbd66127c04.zip
better import/export
SVN=122584
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 b43ae58ccf..e5e95e68eb 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;