source: trunk/sys/libm/s_fabs.c @ 195

Last change on this file since 195 was 1, checked in by alain, 8 years ago

First import

File size: 732 bytes
Line 
1
2/* @(#)s_fabs.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/*
15 * fabs(x) returns the absolute value of x.
16 */
17
18#include <libm/fdlibm.h>
19
20#ifdef __STDC__
21static const double one = 1.0;
22#else
23static double one = 1.0;
24#endif
25
26#ifdef __STDC__
27        double fabs(double x)
28#else
29        double fabs(x)
30        double x;
31#endif
32{
33        *((((*(int*)&one)>>29)^1)+(int*)&x) &= 0x7fffffff;
34        return x;
35}
Note: See TracBrowser for help on using the repository browser.