Print this page
5262 libm needs to be carefully unifdef'd
5268 libm doesn't need to hide symbols which are already local
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/m9x/modf.c
+++ new/usr/src/lib/libm/common/m9x/modf.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.
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
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 /*
26 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 -#if defined(ELFOBJ)
31 30 #pragma weak modf = __modf
32 31 #pragma weak _modf = __modf
33 -#endif
34 32
35 33 /*
36 34 * modf(x, iptr) decomposes x into an integral part and a fractional
37 35 * part both having the same sign as x. It stores the integral part
38 36 * in *iptr and returns the fractional part.
39 37 *
40 38 * If x is infinite, modf sets *iptr to x and returns copysign(0.0,x).
41 39 * If x is NaN, modf sets *iptr to x and returns x.
42 40 *
43 41 * If x is a signaling NaN, this code does not attempt to raise the
44 42 * invalid operation exception.
45 43 */
46 44
47 45 #include "libm.h"
48 46
49 47 double
50 48 __modf(double x, double *iptr) {
51 49 union {
52 50 unsigned i[2];
53 51 double d;
54 52 } xx, yy;
55 53 unsigned hx, s;
56 54
57 55 xx.d = x;
58 56 hx = xx.i[HIWORD] & ~0x80000000;
59 57
60 58 if (hx >= 0x43300000) { /* x is NaN, infinite, or integral */
61 59 *iptr = x;
62 60 if (hx < 0x7ff00000 || (hx == 0x7ff00000 &&
63 61 xx.i[LOWORD] == 0)) {
64 62 xx.i[HIWORD] &= 0x80000000;
65 63 xx.i[LOWORD] = 0;
66 64 }
67 65 return (xx.d);
68 66 }
69 67
70 68 if (hx < 0x3ff00000) { /* |x| < 1 */
71 69 xx.i[HIWORD] &= 0x80000000;
72 70 xx.i[LOWORD] = 0;
73 71 *iptr = xx.d;
74 72 return (x);
75 73 }
76 74
77 75 /* split x at the binary point */
78 76 s = xx.i[HIWORD] & 0x80000000;
79 77 if (hx < 0x41400000) {
80 78 yy.i[HIWORD] = xx.i[HIWORD] & ~((1 << (0x413 - (hx >> 20))) -
81 79 1);
82 80 yy.i[LOWORD] = 0;
83 81 } else {
84 82 yy.i[HIWORD] = xx.i[HIWORD];
85 83 yy.i[LOWORD] = xx.i[LOWORD] & ~((1 << (0x433 - (hx >> 20))) -
86 84 1);
87 85 }
88 86 *iptr = yy.d;
89 87 xx.d -= yy.d;
90 88 xx.i[HIWORD] = (xx.i[HIWORD] & ~0x80000000) | s;
91 89 /* keep sign of x */
92 90 return (xx.d);
93 91 }
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX