Print this page
11210 libm should be cstyle(1ONBLD) clean
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/R/__tanf.c
+++ new/usr/src/lib/libm/common/R/__tanf.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 +
25 26 /*
26 27 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 28 * Use is subject to license terms.
28 29 */
29 30
30 31 #include "libm.h"
31 32
32 -/* INDENT OFF */
33 +
33 34 /*
34 35 * float __k_tan(double x);
35 36 * kernel (float) tan function on [-pi/4, pi/4], pi/4 ~ 0.785398164
36 37 * Input x is in double and assumed to be bounded by ~pi/4 in magnitude.
37 38 *
38 39 * Constants:
39 40 * The hexadecimal values are the intended ones for the following constants.
40 41 * The decimal values may be used, provided that the compiler will convert
41 42 * from decimal to binary accurately enough to produce the hexadecimal values
42 43 * shown.
43 44 */
44 45
45 46 static const double q[] = {
46 -/* one */ 1.0,
47 -/* P0 */ 4.46066928428959230679140546271810308098793029785e-0003,
48 -/* P1 */ 4.92165316309189027066395283327437937259674072266e+0000,
47 +/* one */
48 + 1.0,
49 +/* P0 */ 4.46066928428959230679140546271810308098793029785e-0003,
50 +/* P1 */ 4.92165316309189027066395283327437937259674072266e+0000,
49 51 /* P2 */ -7.11410648161473480044492134766187518835067749023e-0001,
50 -/* P3 */ 4.08549808374053391446523164631798863410949707031e+0000,
51 -/* P4 */ 2.50411070398050927821032018982805311679840087891e+0000,
52 -/* P5 */ 1.11492064560251158411574579076841473579406738281e+0001,
52 +/* P3 */ 4.08549808374053391446523164631798863410949707031e+0000,
53 +/* P4 */ 2.50411070398050927821032018982805311679840087891e+0000,
54 +/* P5 */ 1.11492064560251158411574579076841473579406738281e+0001,
53 55 /* P6 */ -1.50565540968422650891511693771462887525558471680e+0000,
54 56 /* P7 */ -1.81484378878349295050043110677506774663925170898e+0000,
55 -/* T0 */ 3.333335997532835641297409611782510896641e-0001,
56 -/* T1 */ 2.999997598248363761541668282006867229939e+00,
57 +/* T0 */ 3.333335997532835641297409611782510896641e-0001,
58 +/* T1 */ 2.999997598248363761541668282006867229939e+00,
57 59 };
58 -/* INDENT ON */
59 60
60 -#define one q[0]
61 -#define P0 q[1]
62 -#define P1 q[2]
63 -#define P2 q[3]
64 -#define P3 q[4]
65 -#define P4 q[5]
66 -#define P5 q[6]
67 -#define P6 q[7]
68 -#define P7 q[8]
69 -#define T0 q[9]
70 -#define T1 q[10]
61 +
62 +#define one q[0]
63 +#define P0 q[1]
64 +#define P1 q[2]
65 +#define P2 q[3]
66 +#define P3 q[4]
67 +#define P4 q[5]
68 +#define P5 q[6]
69 +#define P6 q[7]
70 +#define P7 q[8]
71 +#define T0 q[9]
72 +#define T1 q[10]
71 73
72 74 float
73 -__k_tanf(double x, int n) {
75 +__k_tanf(double x, int n)
76 +{
74 77 float ft = 0.0;
75 78 double z, w;
76 79 int ix;
77 80
78 - ix = ((int *) &x)[HIWORD] & ~0x80000000; /* ix = leading |x| */
81 + ix = ((int *)&x)[HIWORD] & ~0x80000000; /* ix = leading |x| */
82 +
79 83 /* small argument */
80 - if (ix < 0x3f800000) { /* if |x| < 0.0078125 = 2**-7 */
81 - if (ix < 0x3f100000) { /* if |x| < 2**-14 */
82 - if ((int) x == 0) { /* raise inexact if x != 0 */
83 - ft = n == 0 ? (float) x : (float) (-one / x);
84 - }
84 + if (ix < 0x3f800000) { /* if |x| < 0.0078125 = 2**-7 */
85 + if (ix < 0x3f100000) { /* if |x| < 2**-14 */
86 + if ((int)x == 0) /* raise inexact if x != 0 */
87 + ft = n == 0 ? (float)x : (float)(-one / x);
88 +
85 89 return (ft);
86 90 }
91 +
87 92 z = (x * T0) * (T1 + x * x);
88 - ft = n == 0 ? (float) z : (float) (-one / z);
93 + ft = n == 0 ? (float)z : (float)(-one / z);
89 94 return (ft);
90 95 }
96 +
91 97 z = x * x;
92 - w = ((P0 * x) * (P1 + z * (P2 + z)) * (P3 + z * (P4 + z)))
93 - * (P5 + z * (P6 + z * (P7 + z)));
94 - ft = n == 0 ? (float) w : (float) (-one / w);
98 + w = ((P0 * x) * (P1 + z * (P2 + z)) * (P3 + z * (P4 + z))) * (P5 + z *
99 + (P6 + z * (P7 + z)));
100 + ft = n == 0 ? (float)w : (float)(-one / w);
95 101 return (ft);
96 102 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX