source: trunk/src/gcc/libjava/java/lang/e_exp.c@ 1389

Last change on this file since 1389 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.1 KB
Line 
1
2/* @(#)e_exp.c 5.1 93/09/24 */
3/*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 *
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
12 */
13
14/* __ieee754_exp(x)
15 * Returns the exponential of x.
16 *
17 * Method
18 * 1. Argument reduction:
19 * Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
20 * Given x, find r and integer k such that
21 *
22 * x = k*ln2 + r, |r| <= 0.5*ln2.
23 *
24 * Here r will be represented as r = hi-lo for better
25 * accuracy.
26 *
27 * 2. Approximation of exp(r) by a special rational function on
28 * the interval [0,0.34658]:
29 * Write
30 * R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ...
31 * We use a special Reme algorithm on [0,0.34658] to generate
32 * a polynomial of degree 5 to approximate R. The maximum error
33 * of this polynomial approximation is bounded by 2**-59. In