summaryrefslogtreecommitdiff
path: root/src/lib/math/exp.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-06-27 17:06:23 -0700
committerRob Pike <r@golang.org>2008-06-27 17:06:23 -0700
commit573580453a401dd822e5526e96a6d509e28aa091 (patch)
tree8501a89e8661cea6cf9b422ebd9fd6168cc6aaf5 /src/lib/math/exp.go
parentad249d56cf71b984c267e44419bd25e63ba720c2 (diff)
downloadgolang-573580453a401dd822e5526e96a6d509e28aa091.tar.gz
update to new world. still can't use it but it's a lot of editing....
SVN=125218
Diffstat (limited to 'src/lib/math/exp.go')
-rw-r--r--src/lib/math/exp.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/math/exp.go b/src/lib/math/exp.go
index 8a9542a35..6be61afdf 100644
--- a/src/lib/math/exp.go
+++ b/src/lib/math/exp.go
@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package exp
+package math
-import sys "sys"
-import floor "floor"
+import math "floor"
export exp
/*
@@ -34,21 +33,21 @@ exp(arg double) double
var x, fract, temp1, temp2, xsq double;
var ent int;
- if arg == 0 {
+ if arg == 0. {
return 1;
}
if arg < -maxf {
- return 0;
+ return 0.;
}
if arg > maxf {
- return sys.Inf(1);
+ panic "return sys.Inf(1)"
}
x = arg*log2e;
- ent = int(floor.floor(x));
+ ent = int(floor(x));
fract = (x-double(ent)) - 0.5;
xsq = fract*fract;
temp1 = ((p2*xsq+p1)*xsq+p0)*fract;
temp2 = ((xsq+q2)*xsq+q1)*xsq + q0;
- return sys.ldexp(sqrt2*(temp2+temp1)/(temp2-temp1), ent);
+ return sys.ldexp(ent, sqrt2*(temp2+temp1)/(temp2-temp1));
}