9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 */
24 /*
25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28
29 #pragma weak log1p = __log1p
30
31 /* INDENT OFF */
32 /*
33 * Method :
34 * 1. Argument Reduction: find k and f such that
35 * 1+x = 2^k * (1+f),
36 * where sqrt(2)/2 < 1+f < sqrt(2) .
37 *
38 * Note. If k=0, then f=x is exact. However, if k != 0, then f
39 * may not be representable exactly. In that case, a correction
40 * term is need. Let u=1+x rounded. Let c = (1+x)-u, then
41 * log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),
42 * and add back the correction term c/u.
43 * (Note: when x > 2**53, one can simply return log(x))
44 *
45 * 2. Approximation of log1p(f).
46 * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
47 * = 2s + 2/3 s**3 + 2/5 s**5 + .....,
48 * = 2s + s*R
49 * We use a special Reme algorithm on [0,0.1716] to generate
|
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 */
24 /*
25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28
29 #pragma weak __log1p = log1p
30
31 /* INDENT OFF */
32 /*
33 * Method :
34 * 1. Argument Reduction: find k and f such that
35 * 1+x = 2^k * (1+f),
36 * where sqrt(2)/2 < 1+f < sqrt(2) .
37 *
38 * Note. If k=0, then f=x is exact. However, if k != 0, then f
39 * may not be representable exactly. In that case, a correction
40 * term is need. Let u=1+x rounded. Let c = (1+x)-u, then
41 * log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),
42 * and add back the correction term c/u.
43 * (Note: when x > 2**53, one can simply return log(x))
44 *
45 * 2. Approximation of log1p(f).
46 * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
47 * = 2s + 2/3 s**3 + 2/5 s**5 + .....,
48 * = 2s + s*R
49 * We use a special Reme algorithm on [0,0.1716] to generate
|