Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / powerpc / power4 / fpu / mpa-arch.h
blobde0226858bdf17269d4e7d8f23545734ba2de0c5
1 /* Overridable constants and operations.
2 Copyright (C) 2013-2015 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 typedef double mantissa_t;
18 typedef double mantissa_store_t;
20 #define TWOPOW(i) (0x1.0p##i)
22 #define RADIX TWOPOW (24) /* 2^24 */
23 #define CUTTER TWOPOW (76) /* 2^76 */
24 #define RADIXI 0x1.0p-24 /* 2^-24 */
25 #define TWO52 TWOPOW (52) /* 2^52 */
27 /* Divide D by RADIX and put the remainder in R. */
28 #define DIV_RADIX(d,r) \
29 ({ \
30 double u = ((d) + CUTTER) - CUTTER; \
31 if (u > (d)) \
32 u -= RADIX; \
33 r = (d) - u; \
34 (d) = u * RADIXI; \
37 /* Put the integer component of a double X in R and retain the fraction in
38 X. */
39 #define INTEGER_OF(x, r) \
40 ({ \
41 double u = ((x) + TWO52) - TWO52; \
42 if (u > (x)) \
43 u -= 1; \
44 (r) = u; \
45 (x) -= u; \
48 /* Align IN down to a multiple of F, where F is a power of two. */
49 #define ALIGN_DOWN_TO(in, f) \
50 ({ \
51 double factor = f * TWO52; \
52 double u = (in + factor) - factor; \
53 if (u > in) \
54 u -= f; \
55 u; \