mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
update to new world. still can't use it but it's a lot of editing....
SVN=125218
This commit is contained in:
parent
390d5fe5b2
commit
4331293f41
16 changed files with 59 additions and 66 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue