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 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #if defined(ELFOBJ)
31 #pragma weak modff = __modff
32 #pragma weak _modff = __modff
33 #endif
34
35 #include "libm.h"
36
37 float
38 __modff(float x, float *iptr) {
39 union {
40 unsigned i;
41 float f;
42 } xx, yy;
43 unsigned hx, s;
44
45 xx.f = x;
46 hx = xx.i & ~0x80000000;
47
48 if (hx >= 0x4b000000) { /* x is NaN, infinite, or integral */
49 *iptr = x;
50 if (hx <= 0x7f800000)
51 xx.i &= 0x80000000;
52 return (xx.f);
53 }
|
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 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #pragma weak modff = __modff
31 #pragma weak _modff = __modff
32
33 #include "libm.h"
34
35 float
36 __modff(float x, float *iptr) {
37 union {
38 unsigned i;
39 float f;
40 } xx, yy;
41 unsigned hx, s;
42
43 xx.f = x;
44 hx = xx.i & ~0x80000000;
45
46 if (hx >= 0x4b000000) { /* x is NaN, infinite, or integral */
47 *iptr = x;
48 if (hx <= 0x7f800000)
49 xx.i &= 0x80000000;
50 return (xx.f);
51 }
|