| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| exp returns the exponential func of its |
| The coefficients are #1069 from Hart and Cheney. (22.35D) |
| p0 = .2080384346694663001443843411e7; |
| p1 = .3028697169744036299076048876e5; |
| p2 = .6061485330061080841615584556e2; |
| q0 = .6002720360238832528230907598e7; |
| q1 = .3277251518082914423057964422e6; |
| q2 = .1749287689093076403844945335e4; |
| log2e = .14426950408889634073599247e1; |
| sqrt2 = .14142135623730950488016887e1; |
| var x, fract, temp1, temp2, xsq double; |
| fract = (x-double(ent)) - 0.5; |
| temp1 = ((p2*xsq+p1)*xsq+p0)*fract; |
| temp2 = ((xsq+q2)*xsq+q1)*xsq + q0; |
| return sys.ldexp(ent, sqrt2*(temp2+temp1)/(temp2-temp1)); |