1 | /* s_fabsl.c -- long double version of s_fabs.c. |
2 | */ |
3 | |
4 | /* |
5 | * ==================================================== |
6 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
7 | * |
8 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
9 | * Permission to use, copy, modify, and distribute this |
10 | * software is freely granted, provided that this notice |
11 | * is preserved. |
12 | * ==================================================== |
13 | */ |
14 | |
15 | #if defined(LIBM_SCCS) && !defined(lint) |
16 | static char rcsid[] = "$NetBSD: $" ; |
17 | #endif |
18 | |
19 | |
20 | /* |
21 | * fabsl(x) returns the absolute value of x. |
22 | */ |
23 | |
24 | #include <math.h> |
25 | #include <math_private.h> |
26 | #include <math_ldbl_opt.h> |
27 | |
28 | long double __fabsl(long double x) |
29 | { |
30 | uint64_t hx, lx; |
31 | double xhi, xlo; |
32 | |
33 | ldbl_unpack (x, &xhi, &xlo); |
34 | EXTRACT_WORDS64 (hx, xhi); |
35 | EXTRACT_WORDS64 (lx, xlo); |
36 | lx = lx ^ ( hx & 0x8000000000000000LL ); |
37 | hx = hx & 0x7fffffffffffffffLL; |
38 | INSERT_WORDS64 (xhi, hx); |
39 | INSERT_WORDS64 (xlo, lx); |
40 | x = ldbl_pack (xhi, xlo); |
41 | return x; |
42 | } |
43 | long_double_symbol (libm, __fabsl, fabsl); |
44 | |