From 573580453a401dd822e5526e96a6d509e28aa091 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Fri, 27 Jun 2008 17:06:23 -0700 Subject: update to new world. still can't use it but it's a lot of editing.... SVN=125218 --- src/lib/math/exp.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/lib/math/exp.go') 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)); } -- cgit v1.2.3