xref: /freebsd/lib/msun/src/s_fabs.c (revision 0dd5a5603e7a33d976f8e6015620bbc79839c609)
13a8617a8SJordan K. Hubbard /*
23a8617a8SJordan K. Hubbard  * ====================================================
33a8617a8SJordan K. Hubbard  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
43a8617a8SJordan K. Hubbard  *
53a8617a8SJordan K. Hubbard  * Developed at SunPro, a Sun Microsystems, Inc. business.
63a8617a8SJordan K. Hubbard  * Permission to use, copy, modify, and distribute this
73a8617a8SJordan K. Hubbard  * software is freely granted, provided that this notice
83a8617a8SJordan K. Hubbard  * is preserved.
93a8617a8SJordan K. Hubbard  * ====================================================
103a8617a8SJordan K. Hubbard  */
113a8617a8SJordan K. Hubbard 
123a8617a8SJordan K. Hubbard /*
133a8617a8SJordan K. Hubbard  * fabs(x) returns the absolute value of x.
143a8617a8SJordan K. Hubbard  */
153a8617a8SJordan K. Hubbard 
163a8617a8SJordan K. Hubbard #include "math.h"
173a8617a8SJordan K. Hubbard #include "math_private.h"
183a8617a8SJordan K. Hubbard 
1959b19ff1SAlfred Perlstein double
fabs(double x)2059b19ff1SAlfred Perlstein fabs(double x)
213a8617a8SJordan K. Hubbard {
223a8617a8SJordan K. Hubbard 	u_int32_t high;
233a8617a8SJordan K. Hubbard 	GET_HIGH_WORD(high,x);
243a8617a8SJordan K. Hubbard 	SET_HIGH_WORD(x,high&0x7fffffff);
253a8617a8SJordan K. Hubbard         return x;
263a8617a8SJordan K. Hubbard }
27