]> git.ipfire.org Git - thirdparty/glibc.git/blame - math/tgmath.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / math / tgmath.h
CommitLineData
dff8da6b 1/* Copyright (C) 1997-2024 Free Software Foundation, Inc.
dfd2257a
UD
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
dfd2257a
UD
8
9 The GNU C Library 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 GNU
41bdb6e2 12 Lesser General Public License for more details.
dfd2257a 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
dfd2257a
UD
17
18/*
63ae7b63 19 * ISO C99 Standard: 7.22 Type-generic math <tgmath.h>
dfd2257a
UD
20 */
21
22#ifndef _TGMATH_H
23#define _TGMATH_H 1
24
614d15f9
JM
25#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
26#include <bits/libc-header-start.h>
27
dfd2257a 28/* Include the needed headers. */
614d15f9 29#include <bits/floatn.h>
dfd2257a
UD
30#include <math.h>
31#include <complex.h>
32
33
be3a79a3
JM
34/* There are two variant implementations of type-generic macros in
35 this file: one for GCC 8 and later, using __builtin_tgmath and
36 where each macro expands each of its arguments only once, and one
37 for older GCC, using other compiler extensions but with macros
38 expanding their arguments many times (so resulting in exponential
39 blowup of the size of expansions when calls to such macros are
8a78f833
JM
40 nested inside arguments to such macros). Because of a long series
41 of defect fixes made after the initial release of TS 18661-1, GCC
42 versions before GCC 13 have __builtin_tgmath semantics that, when
43 integer arguments are passed to narrowing macros returning
44 _Float32x, or non-narrowing macros with at least two generic
45 arguments, do not always correspond to the C2X semantics, so more
46 complicated macro definitions are also used in some cases for
47 versions from GCC 8 to GCC 12. */
be3a79a3
JM
48
49#define __HAVE_BUILTIN_TGMATH __GNUC_PREREQ (8, 0)
8a78f833 50#define __HAVE_BUILTIN_TGMATH_C2X __GNUC_PREREQ (13, 0)
dfd2257a 51
4360eafd 52#if __GNUC_PREREQ (2, 7)
dfd2257a 53
f9fabc1b
JM
54/* Certain cases of narrowing macros only need to call a single
55 function so cannot use __builtin_tgmath and do not need any
56 complicated logic. */
57# if __HAVE_FLOAT128X
58# error "Unsupported _Float128x type for <tgmath.h>."
59# endif
60# if ((__HAVE_FLOAT64X && !__HAVE_FLOAT128) \
61 || (__HAVE_FLOAT128 && !__HAVE_FLOAT64X))
62# error "Unsupported combination of types for <tgmath.h>."
63# endif
abd38358
JM
64# define __TGMATH_1_NARROW_D(F, X) \
65 (F ## l (X))
f9fabc1b
JM
66# define __TGMATH_2_NARROW_D(F, X, Y) \
67 (F ## l (X, Y))
b3f27d81
JM
68# define __TGMATH_3_NARROW_D(F, X, Y, Z) \
69 (F ## l (X, Y, Z))
abd38358
JM
70# define __TGMATH_1_NARROW_F64X(F, X) \
71 (F ## f128 (X))
f9fabc1b
JM
72# define __TGMATH_2_NARROW_F64X(F, X, Y) \
73 (F ## f128 (X, Y))
b3f27d81
JM
74# define __TGMATH_3_NARROW_F64X(F, X, Y, Z) \
75 (F ## f128 (X, Y, Z))
f9fabc1b 76# if !__HAVE_FLOAT128
abd38358
JM
77# define __TGMATH_1_NARROW_F32X(F, X) \
78 (F ## f64 (X))
f9fabc1b
JM
79# define __TGMATH_2_NARROW_F32X(F, X, Y) \
80 (F ## f64 (X, Y))
b3f27d81
JM
81# define __TGMATH_3_NARROW_F32X(F, X, Y, Z) \
82 (F ## f64 (X, Y, Z))
f9fabc1b
JM
83# endif
84
be3a79a3 85# if __HAVE_BUILTIN_TGMATH
0d3fee40 86
be3a79a3
JM
87# if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
88# define __TG_F16_ARG(X) X ## f16,
89# else
90# define __TG_F16_ARG(X)
91# endif
92# if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
93# define __TG_F32_ARG(X) X ## f32,
94# else
95# define __TG_F32_ARG(X)
96# endif
97# if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
98# define __TG_F64_ARG(X) X ## f64,
99# else
100# define __TG_F64_ARG(X)
101# endif
102# if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
103# define __TG_F128_ARG(X) X ## f128,
104# else
105# define __TG_F128_ARG(X)
106# endif
107# if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
108# define __TG_F32X_ARG(X) X ## f32x,
109# else
110# define __TG_F32X_ARG(X)
111# endif
112# if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
113# define __TG_F64X_ARG(X) X ## f64x,
114# else
115# define __TG_F64X_ARG(X)
116# endif
117# if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
118# define __TG_F128X_ARG(X) X ## f128x,
119# else
120# define __TG_F128X_ARG(X)
121# endif
122
123# define __TGMATH_FUNCS(X) X ## f, X, X ## l, \
124 __TG_F16_ARG (X) __TG_F32_ARG (X) __TG_F64_ARG (X) __TG_F128_ARG (X) \
125 __TG_F32X_ARG (X) __TG_F64X_ARG (X) __TG_F128X_ARG (X)
126# define __TGMATH_RCFUNCS(F, C) __TGMATH_FUNCS (F) __TGMATH_FUNCS (C)
127# define __TGMATH_1(F, X) __builtin_tgmath (__TGMATH_FUNCS (F) (X))
128# define __TGMATH_2(F, X, Y) __builtin_tgmath (__TGMATH_FUNCS (F) (X), (Y))
129# define __TGMATH_2STD(F, X, Y) __builtin_tgmath (F ## f, F, F ## l, (X), (Y))
130# define __TGMATH_3(F, X, Y, Z) __builtin_tgmath (__TGMATH_FUNCS (F) \
131 (X), (Y), (Z))
132# define __TGMATH_1C(F, C, X) __builtin_tgmath (__TGMATH_RCFUNCS (F, C) (X))
133# define __TGMATH_2C(F, C, X, Y) __builtin_tgmath (__TGMATH_RCFUNCS (F, C) \
134 (X), (Y))
135
f9fabc1b
JM
136# define __TGMATH_NARROW_FUNCS_F(X) X, X ## l,
137# define __TGMATH_NARROW_FUNCS_F16(X) \
138 __TG_F32_ARG (X) __TG_F64_ARG (X) __TG_F128_ARG (X) \
139 __TG_F32X_ARG (X) __TG_F64X_ARG (X) __TG_F128X_ARG (X)
140# define __TGMATH_NARROW_FUNCS_F32(X) \
141 __TG_F64_ARG (X) __TG_F128_ARG (X) \
142 __TG_F32X_ARG (X) __TG_F64X_ARG (X) __TG_F128X_ARG (X)
143# define __TGMATH_NARROW_FUNCS_F64(X) \
144 __TG_F128_ARG (X) \
145 __TG_F64X_ARG (X) __TG_F128X_ARG (X)
146# define __TGMATH_NARROW_FUNCS_F32X(X) \
147 __TG_F64X_ARG (X) __TG_F128X_ARG (X) \
148 __TG_F64_ARG (X) __TG_F128_ARG (X)
149
abd38358
JM
150# define __TGMATH_1_NARROW_F(F, X) \
151 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F (F) (X))
f9fabc1b
JM
152# define __TGMATH_2_NARROW_F(F, X, Y) \
153 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F (F) (X), (Y))
b3f27d81
JM
154# define __TGMATH_3_NARROW_F(F, X, Y, Z) \
155 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F (F) (X), (Y), (Z))
abd38358
JM
156# define __TGMATH_1_NARROW_F16(F, X) \
157 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F16 (F) (X))
f9fabc1b
JM
158# define __TGMATH_2_NARROW_F16(F, X, Y) \
159 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F16 (F) (X), (Y))
b3f27d81
JM
160# define __TGMATH_3_NARROW_F16(F, X, Y, Z) \
161 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F16 (F) (X), (Y), (Z))
abd38358
JM
162# define __TGMATH_1_NARROW_F32(F, X) \
163 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F32 (F) (X))
f9fabc1b
JM
164# define __TGMATH_2_NARROW_F32(F, X, Y) \
165 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F32 (F) (X), (Y))
b3f27d81
JM
166# define __TGMATH_3_NARROW_F32(F, X, Y, Z) \
167 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F32 (F) (X), (Y), (Z))
abd38358
JM
168# define __TGMATH_1_NARROW_F64(F, X) \
169 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F64 (F) (X))
f9fabc1b
JM
170# define __TGMATH_2_NARROW_F64(F, X, Y) \
171 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F64 (F) (X), (Y))
b3f27d81
JM
172# define __TGMATH_3_NARROW_F64(F, X, Y, Z) \
173 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F64 (F) (X), (Y), (Z))
8a78f833 174# if __HAVE_FLOAT128 && __HAVE_BUILTIN_TGMATH_C2X
abd38358
JM
175# define __TGMATH_1_NARROW_F32X(F, X) \
176 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F32X (F) (X))
f9fabc1b
JM
177# define __TGMATH_2_NARROW_F32X(F, X, Y) \
178 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F32X (F) (X), (Y))
b3f27d81
JM
179# define __TGMATH_3_NARROW_F32X(F, X, Y, Z) \
180 __builtin_tgmath (__TGMATH_NARROW_FUNCS_F32X (F) (X), (Y), (Z))
f9fabc1b
JM
181# endif
182
8a78f833 183# endif
be3a79a3 184
8a78f833 185# if !__HAVE_BUILTIN_TGMATH_C2X
be3a79a3
JM
186# ifdef __NO_LONG_DOUBLE_MATH
187# define __tgml(fct) fct
188# else
189# define __tgml(fct) fct ## l
190# endif
925e31d9 191
d9bef9c0
JM
192/* __floating_type expands to 1 if TYPE is a floating type (including
193 complex floating types), 0 if TYPE is an integer type (including
194 complex integer types). __real_integer_type expands to 1 if TYPE
195 is a real integer type. __complex_integer_type expands to 1 if
196 TYPE is a complex integer type. All these macros expand to integer
197 constant expressions. All these macros can assume their argument
198 has an arithmetic type (not vector, decimal floating-point or
199 fixed-point), valid to pass to tgmath.h macros. */
be3a79a3 200# if __GNUC_PREREQ (3, 1)
d9bef9c0
JM
201/* __builtin_classify_type expands to an integer constant expression
202 in GCC 3.1 and later. Default conversions applied to the argument
203 of __builtin_classify_type mean it always returns 1 for real
204 integer types rather than ever returning different values for
205 character, boolean or enumerated types. */
be3a79a3 206# define __floating_type(type) \
d9bef9c0 207 (__builtin_classify_type (__real__ ((type) 0)) == 8)
be3a79a3 208# define __real_integer_type(type) \
d9bef9c0 209 (__builtin_classify_type ((type) 0) == 1)
be3a79a3 210# define __complex_integer_type(type) \
d9bef9c0
JM
211 (__builtin_classify_type ((type) 0) == 9 \
212 && __builtin_classify_type (__real__ ((type) 0)) == 1)
be3a79a3 213# else
d9bef9c0
JM
214/* GCC versions predating __builtin_classify_type are also looser on
215 what counts as an integer constant expression. */
be3a79a3
JM
216# define __floating_type(type) (((type) 1.25) != 1)
217# define __real_integer_type(type) (((type) (1.25 + _Complex_I)) == 1)
218# define __complex_integer_type(type) \
d9bef9c0 219 (((type) (1.25 + _Complex_I)) == (1 + _Complex_I))
be3a79a3 220# endif
925e31d9 221
d9bef9c0 222/* Whether an expression (of arithmetic type) has a real type. */
be3a79a3 223# define __expr_is_real(E) (__builtin_classify_type (E) != 9)
d9bef9c0 224
8a78f833
JM
225/* Type T1 if E is 1, type T2 is E is 0. */
226# define __tgmath_type_if(T1, T2, E) \
227 __typeof__ (*(0 ? (__typeof__ (0 ? (T2 *) 0 : (void *) (E))) 0 \
228 : (__typeof__ (0 ? (T1 *) 0 : (void *) (!(E)))) 0))
229
d9bef9c0
JM
230/* The tgmath real type for T, where E is 0 if T is an integer type
231 and 1 for a floating type. If T has a complex type, it is
232 unspecified whether the return type is real or complex (but it has
233 the correct corresponding real type). */
be3a79a3 234# define __tgmath_real_type_sub(T, E) \
8a78f833 235 __tgmath_type_if (T, double, E)
925e31d9
UD
236
237/* The tgmath real type of EXPR. */
be3a79a3 238# define __tgmath_real_type(expr) \
2fee621d
JM
239 __tgmath_real_type_sub (__typeof__ ((__typeof__ (+(expr))) 0), \
240 __floating_type (__typeof__ (+(expr))))
925e31d9 241
d9bef9c0
JM
242/* The tgmath complex type for T, where E1 is 1 if T has a floating
243 type and 0 otherwise, E2 is 1 if T has a real integer type and 0
244 otherwise, and E3 is 1 if T has a complex type and 0 otherwise. */
be3a79a3 245# define __tgmath_complex_type_sub(T, E1, E2, E3) \
d9bef9c0
JM
246 __typeof__ (*(0 \
247 ? (__typeof__ (0 ? (T *) 0 : (void *) (!(E1)))) 0 \
248 : (__typeof__ (0 \
249 ? (__typeof__ (0 \
250 ? (double *) 0 \
251 : (void *) (!(E2)))) 0 \
252 : (__typeof__ (0 \
253 ? (_Complex double *) 0 \
254 : (void *) (!(E3)))) 0)) 0))
255
256/* The tgmath complex type of EXPR. */
be3a79a3 257# define __tgmath_complex_type(expr) \
d9bef9c0
JM
258 __tgmath_complex_type_sub (__typeof__ ((__typeof__ (+(expr))) 0), \
259 __floating_type (__typeof__ (+(expr))), \
260 __real_integer_type (__typeof__ (+(expr))), \
261 __complex_integer_type (__typeof__ (+(expr))))
262
8a78f833
JM
263/* The tgmath real type of EXPR1 combined with EXPR2, without handling
264 the C2X rule of interpreting integer arguments as _Float32x if any
265 argument is _FloatNx. */
266# define __tgmath_real_type2_base(expr1, expr2) \
267 __typeof ((__tgmath_real_type (expr1)) 0 + (__tgmath_real_type (expr2)) 0)
268
269/* The tgmath complex type of EXPR1 combined with EXPR2, without
270 handling the C2X rule of interpreting integer arguments as
271 _Float32x if any argument is _FloatNx. */
272# define __tgmath_complex_type2_base(expr1, expr2) \
273 __typeof ((__tgmath_complex_type (expr1)) 0 \
274 + (__tgmath_complex_type (expr2)) 0)
275
276/* The tgmath real type of EXPR1 combined with EXPR2 and EXPR3,
277 without handling the C2X rule of interpreting integer arguments as
278 _Float32x if any argument is _FloatNx. */
279# define __tgmath_real_type3_base(expr1, expr2, expr3) \
280 __typeof ((__tgmath_real_type (expr1)) 0 \
281 + (__tgmath_real_type (expr2)) 0 \
282 + (__tgmath_real_type (expr3)) 0)
283
284/* The tgmath real or complex type of EXPR1 combined with EXPR2 (and
285 EXPR3 if applicable). */
286# if __HAVE_FLOATN_NOT_TYPEDEF
287# define __tgmath_real_type2(expr1, expr2) \
288 __tgmath_type_if (_Float32x, __tgmath_real_type2_base (expr1, expr2), \
289 _Generic ((expr1) + (expr2), _Float32x: 1, default: 0))
290# define __tgmath_complex_type2(expr1, expr2) \
291 __tgmath_type_if (_Float32x, \
292 __tgmath_type_if (_Complex _Float32x, \
293 __tgmath_complex_type2_base (expr1, \
294 expr2), \
295 _Generic ((expr1) + (expr2), \
296 _Complex _Float32x: 1, \
297 default: 0)), \
298 _Generic ((expr1) + (expr2), _Float32x: 1, default: 0))
299# define __tgmath_real_type3(expr1, expr2, expr3) \
300 __tgmath_type_if (_Float32x, \
301 __tgmath_real_type3_base (expr1, expr2, expr3), \
302 _Generic ((expr1) + (expr2) + (expr3), \
303 _Float32x: 1, default: 0))
304# else
305# define __tgmath_real_type2(expr1, expr2) \
306 __tgmath_real_type2_base (expr1, expr2)
307# define __tgmath_complex_type2(expr1, expr2) \
308 __tgmath_complex_type2_base (expr1, expr2)
309# define __tgmath_real_type3(expr1, expr2, expr3) \
310 __tgmath_real_type3_base (expr1, expr2, expr3)
311# endif
312
be3a79a3 313# if (__HAVE_DISTINCT_FLOAT16 \
86ec4865
JM
314 || __HAVE_DISTINCT_FLOAT32 \
315 || __HAVE_DISTINCT_FLOAT64 \
316 || __HAVE_DISTINCT_FLOAT32X \
317 || __HAVE_DISTINCT_FLOAT64X \
318 || __HAVE_DISTINCT_FLOAT128X)
be3a79a3
JM
319# error "Unsupported _FloatN or _FloatNx types for <tgmath.h>."
320# endif
86ec4865 321
614d15f9
JM
322/* Expand to text that checks if ARG_COMB has type _Float128, and if
323 so calls the appropriately suffixed FCT (which may include a cast),
8a78f833
JM
324 or FCT and CFCT for complex functions, with arguments ARG_CALL.
325 __TGMATH_F128LD (only used in the __HAVE_FLOAT64X_LONG_DOUBLE case,
326 for narrowing macros) handles long double the same as
327 _Float128. */
be3a79a3
JM
328# if __HAVE_DISTINCT_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
329# if (!__HAVE_FLOAT64X \
86ec4865
JM
330 || __HAVE_FLOAT64X_LONG_DOUBLE \
331 || !__HAVE_FLOATN_NOT_TYPEDEF)
be3a79a3 332# define __TGMATH_F128(arg_comb, fct, arg_call) \
2fee621d 333 __builtin_types_compatible_p (__typeof (+(arg_comb)), _Float128) \
614d15f9 334 ? fct ## f128 arg_call :
8a78f833
JM
335# define __TGMATH_F128LD(arg_comb, fct, arg_call) \
336 (__builtin_types_compatible_p (__typeof (+(arg_comb)), _Float128) \
337 || __builtin_types_compatible_p (__typeof (+(arg_comb)), long double)) \
338 ? fct ## f128 arg_call :
be3a79a3 339# define __TGMATH_CF128(arg_comb, fct, cfct, arg_call) \
2fee621d 340 __builtin_types_compatible_p (__typeof (+__real__ (arg_comb)), _Float128) \
d9bef9c0 341 ? (__expr_is_real (arg_comb) \
614d15f9
JM
342 ? fct ## f128 arg_call \
343 : cfct ## f128 arg_call) :
be3a79a3 344# else
86ec4865
JM
345/* _Float64x is a distinct type at the C language level, which must be
346 handled like _Float128. */
be3a79a3 347# define __TGMATH_F128(arg_comb, fct, arg_call) \
86ec4865
JM
348 (__builtin_types_compatible_p (__typeof (+(arg_comb)), _Float128) \
349 || __builtin_types_compatible_p (__typeof (+(arg_comb)), _Float64x)) \
350 ? fct ## f128 arg_call :
be3a79a3 351# define __TGMATH_CF128(arg_comb, fct, cfct, arg_call) \
86ec4865
JM
352 (__builtin_types_compatible_p (__typeof (+__real__ (arg_comb)), _Float128) \
353 || __builtin_types_compatible_p (__typeof (+__real__ (arg_comb)), \
354 _Float64x)) \
355 ? (__expr_is_real (arg_comb) \
356 ? fct ## f128 arg_call \
357 : cfct ## f128 arg_call) :
be3a79a3
JM
358# endif
359# else
360# define __TGMATH_F128(arg_comb, fct, arg_call) /* Nothing. */
361# define __TGMATH_CF128(arg_comb, fct, cfct, arg_call) /* Nothing. */
86ec4865 362# endif
614d15f9 363
8a78f833 364# endif /* !__HAVE_BUILTIN_TGMATH_C2X. */
925e31d9 365
dfd2257a
UD
366/* We have two kinds of generic macros: to support functions which are
367 only defined on real valued parameters and those which are defined
368 for complex functions as well. */
be3a79a3
JM
369# if __HAVE_BUILTIN_TGMATH
370
371# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) __TGMATH_1 (Fct, (Val))
372# define __TGMATH_UNARY_REAL_RET_ONLY(Val, Fct) __TGMATH_1 (Fct, (Val))
373# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
374 __TGMATH_2 (Fct, (Val1), (Val2))
375# define __TGMATH_BINARY_FIRST_REAL_STD_ONLY(Val1, Val2, Fct) \
376 __TGMATH_2STD (Fct, (Val1), (Val2))
8a78f833
JM
377# if __HAVE_BUILTIN_TGMATH_C2X
378# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
be3a79a3 379 __TGMATH_2 (Fct, (Val1), (Val2))
8a78f833 380# endif
be3a79a3
JM
381# define __TGMATH_BINARY_REAL_STD_ONLY(Val1, Val2, Fct) \
382 __TGMATH_2STD (Fct, (Val1), (Val2))
8a78f833
JM
383# if __HAVE_BUILTIN_TGMATH_C2X
384# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
be3a79a3 385 __TGMATH_3 (Fct, (Val1), (Val2), (Val3))
8a78f833 386# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
be3a79a3 387 __TGMATH_3 (Fct, (Val1), (Val2), (Val3))
8a78f833 388# endif
be3a79a3
JM
389# define __TGMATH_TERNARY_FIRST_REAL_RET_ONLY(Val1, Val2, Val3, Fct) \
390 __TGMATH_3 (Fct, (Val1), (Val2), (Val3))
391# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
392 __TGMATH_1C (Fct, Cfct, (Val))
393# define __TGMATH_UNARY_IMAG(Val, Cfct) __TGMATH_1 (Cfct, (Val))
394# define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
395 __TGMATH_1C (Fct, Cfct, (Val))
396# define __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME(Val, Cfct) \
397 __TGMATH_1 (Cfct, (Val))
8a78f833
JM
398# if __HAVE_BUILTIN_TGMATH_C2X
399# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
be3a79a3 400 __TGMATH_2C (Fct, Cfct, (Val1), (Val2))
8a78f833 401# endif
be3a79a3 402
8a78f833 403# endif
be3a79a3 404
8a78f833 405# if !__HAVE_BUILTIN_TGMATH
be3a79a3 406# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
2fee621d 407 (__extension__ ((sizeof (+(Val)) == sizeof (double) \
1c298d08
UD
408 || __builtin_classify_type (Val) != 8) \
409 ? (__tgmath_real_type (Val)) Fct (Val) \
2fee621d 410 : (sizeof (+(Val)) == sizeof (float)) \
1c298d08 411 ? (__tgmath_real_type (Val)) Fct##f (Val) \
614d15f9
JM
412 : __TGMATH_F128 ((Val), (__tgmath_real_type (Val)) Fct, \
413 (Val)) \
414 (__tgmath_real_type (Val)) __tgml(Fct) (Val)))
71502ebe 415
be3a79a3 416# define __TGMATH_UNARY_REAL_RET_ONLY(Val, Fct) \
2fee621d 417 (__extension__ ((sizeof (+(Val)) == sizeof (double) \
1c298d08 418 || __builtin_classify_type (Val) != 8) \
cfa44345 419 ? Fct (Val) \
2fee621d 420 : (sizeof (+(Val)) == sizeof (float)) \
cfa44345 421 ? Fct##f (Val) \
614d15f9
JM
422 : __TGMATH_F128 ((Val), Fct, (Val)) \
423 __tgml(Fct) (Val)))
dfd2257a 424
be3a79a3 425# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
2fee621d 426 (__extension__ ((sizeof (+(Val1)) == sizeof (double) \
614d15f9
JM
427 || __builtin_classify_type (Val1) != 8) \
428 ? (__tgmath_real_type (Val1)) Fct (Val1, Val2) \
2fee621d 429 : (sizeof (+(Val1)) == sizeof (float)) \
614d15f9
JM
430 ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2) \
431 : __TGMATH_F128 ((Val1), (__tgmath_real_type (Val1)) Fct, \
432 (Val1, Val2)) \
433 (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
434
be3a79a3 435# define __TGMATH_BINARY_FIRST_REAL_STD_ONLY(Val1, Val2, Fct) \
2fee621d 436 (__extension__ ((sizeof (+(Val1)) == sizeof (double) \
1c298d08
UD
437 || __builtin_classify_type (Val1) != 8) \
438 ? (__tgmath_real_type (Val1)) Fct (Val1, Val2) \
2fee621d 439 : (sizeof (+(Val1)) == sizeof (float)) \
1c298d08
UD
440 ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2) \
441 : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
8a78f833 442# endif
dfd2257a 443
8a78f833 444# if !__HAVE_BUILTIN_TGMATH_C2X
be3a79a3 445# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
42df8d59 446 (__extension__ ((sizeof ((Val1) + (Val2)) > sizeof (double) \
1c298d08 447 && __builtin_classify_type ((Val1) + (Val2)) == 8) \
614d15f9 448 ? __TGMATH_F128 ((Val1) + (Val2), \
8a78f833 449 (__tgmath_real_type2 (Val1, Val2)) Fct, \
614d15f9 450 (Val1, Val2)) \
8a78f833 451 (__tgmath_real_type2 (Val1, Val2)) \
614d15f9 452 __tgml(Fct) (Val1, Val2) \
2fee621d
JM
453 : (sizeof (+(Val1)) == sizeof (double) \
454 || sizeof (+(Val2)) == sizeof (double) \
614d15f9
JM
455 || __builtin_classify_type (Val1) != 8 \
456 || __builtin_classify_type (Val2) != 8) \
8a78f833 457 ? (__tgmath_real_type2 (Val1, Val2)) \
614d15f9 458 Fct (Val1, Val2) \
8a78f833 459 : (__tgmath_real_type2 (Val1, Val2)) \
614d15f9 460 Fct##f (Val1, Val2)))
8a78f833 461# endif
614d15f9 462
8a78f833 463# if !__HAVE_BUILTIN_TGMATH
be3a79a3 464# define __TGMATH_BINARY_REAL_STD_ONLY(Val1, Val2, Fct) \
42df8d59 465 (__extension__ ((sizeof ((Val1) + (Val2)) > sizeof (double) \
614d15f9
JM
466 && __builtin_classify_type ((Val1) + (Val2)) == 8) \
467 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
468 + (__tgmath_real_type (Val2)) 0)) \
1c298d08 469 __tgml(Fct) (Val1, Val2) \
2fee621d
JM
470 : (sizeof (+(Val1)) == sizeof (double) \
471 || sizeof (+(Val2)) == sizeof (double) \
1c298d08
UD
472 || __builtin_classify_type (Val1) != 8 \
473 || __builtin_classify_type (Val2) != 8) \
474 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
475 + (__tgmath_real_type (Val2)) 0)) \
476 Fct (Val1, Val2) \
477 : (__typeof ((__tgmath_real_type (Val1)) 0 \
478 + (__tgmath_real_type (Val2)) 0)) \
479 Fct##f (Val1, Val2)))
8a78f833 480# endif
dfd2257a 481
8a78f833 482# if !__HAVE_BUILTIN_TGMATH_C2X
be3a79a3 483# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
42df8d59 484 (__extension__ ((sizeof ((Val1) + (Val2)) > sizeof (double) \
1c298d08 485 && __builtin_classify_type ((Val1) + (Val2)) == 8) \
614d15f9 486 ? __TGMATH_F128 ((Val1) + (Val2), \
8a78f833 487 (__tgmath_real_type2 (Val1, Val2)) Fct, \
614d15f9 488 (Val1, Val2, Val3)) \
8a78f833 489 (__tgmath_real_type2 (Val1, Val2)) \
614d15f9 490 __tgml(Fct) (Val1, Val2, Val3) \
2fee621d
JM
491 : (sizeof (+(Val1)) == sizeof (double) \
492 || sizeof (+(Val2)) == sizeof (double) \
1c298d08
UD
493 || __builtin_classify_type (Val1) != 8 \
494 || __builtin_classify_type (Val2) != 8) \
8a78f833 495 ? (__tgmath_real_type2 (Val1, Val2)) \
1c298d08 496 Fct (Val1, Val2, Val3) \
8a78f833 497 : (__tgmath_real_type2 (Val1, Val2)) \
1c298d08 498 Fct##f (Val1, Val2, Val3)))
bfce746a 499
be3a79a3 500# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
42df8d59 501 (__extension__ ((sizeof ((Val1) + (Val2) + (Val3)) > sizeof (double) \
1c298d08
UD
502 && __builtin_classify_type ((Val1) + (Val2) + (Val3)) \
503 == 8) \
614d15f9 504 ? __TGMATH_F128 ((Val1) + (Val2) + (Val3), \
8a78f833
JM
505 (__tgmath_real_type3 (Val1, Val2, \
506 Val3)) Fct, \
614d15f9 507 (Val1, Val2, Val3)) \
8a78f833 508 (__tgmath_real_type3 (Val1, Val2, Val3)) \
1c298d08 509 __tgml(Fct) (Val1, Val2, Val3) \
2fee621d
JM
510 : (sizeof (+(Val1)) == sizeof (double) \
511 || sizeof (+(Val2)) == sizeof (double) \
512 || sizeof (+(Val3)) == sizeof (double) \
1c298d08
UD
513 || __builtin_classify_type (Val1) != 8 \
514 || __builtin_classify_type (Val2) != 8 \
515 || __builtin_classify_type (Val3) != 8) \
8a78f833 516 ? (__tgmath_real_type3 (Val1, Val2, Val3)) \
1c298d08 517 Fct (Val1, Val2, Val3) \
8a78f833 518 : (__tgmath_real_type3 (Val1, Val2, Val3)) \
1c298d08 519 Fct##f (Val1, Val2, Val3)))
8a78f833 520# endif
dfd2257a 521
8a78f833 522# if !__HAVE_BUILTIN_TGMATH
be3a79a3 523# define __TGMATH_TERNARY_FIRST_REAL_RET_ONLY(Val1, Val2, Val3, Fct) \
2fee621d 524 (__extension__ ((sizeof (+(Val1)) == sizeof (double) \
423c2b9d 525 || __builtin_classify_type (Val1) != 8) \
cfa44345 526 ? Fct (Val1, Val2, Val3) \
2fee621d 527 : (sizeof (+(Val1)) == sizeof (float)) \
cfa44345 528 ? Fct##f (Val1, Val2, Val3) \
614d15f9
JM
529 : __TGMATH_F128 ((Val1), Fct, (Val1, Val2, Val3)) \
530 __tgml(Fct) (Val1, Val2, Val3)))
423c2b9d 531
48244d09
UD
532/* XXX This definition has to be changed as soon as the compiler understands
533 the imaginary keyword. */
be3a79a3 534# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
2fee621d 535 (__extension__ ((sizeof (+__real__ (Val)) == sizeof (double) \
1c298d08 536 || __builtin_classify_type (__real__ (Val)) != 8) \
d9bef9c0
JM
537 ? (__expr_is_real (Val) \
538 ? (__tgmath_complex_type (Val)) Fct (Val) \
539 : (__tgmath_complex_type (Val)) Cfct (Val)) \
2fee621d 540 : (sizeof (+__real__ (Val)) == sizeof (float)) \
d9bef9c0
JM
541 ? (__expr_is_real (Val) \
542 ? (__tgmath_complex_type (Val)) Fct##f (Val) \
543 : (__tgmath_complex_type (Val)) Cfct##f (Val)) \
544 : __TGMATH_CF128 ((Val), \
545 (__tgmath_complex_type (Val)) Fct, \
546 (__tgmath_complex_type (Val)) Cfct, \
614d15f9 547 (Val)) \
d9bef9c0
JM
548 (__expr_is_real (Val) \
549 ? (__tgmath_complex_type (Val)) __tgml(Fct) (Val) \
550 : (__tgmath_complex_type (Val)) __tgml(Cfct) (Val))))
1c298d08 551
be3a79a3 552# define __TGMATH_UNARY_IMAG(Val, Cfct) \
2fee621d 553 (__extension__ ((sizeof (+__real__ (Val)) == sizeof (double) \
1c298d08
UD
554 || __builtin_classify_type (__real__ (Val)) != 8) \
555 ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
556 + _Complex_I)) Cfct (Val) \
2fee621d 557 : (sizeof (+__real__ (Val)) == sizeof (float)) \
1c298d08
UD
558 ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
559 + _Complex_I)) Cfct##f (Val) \
614d15f9
JM
560 : __TGMATH_F128 (__real__ (Val), \
561 (__typeof__ \
562 ((__tgmath_real_type (Val)) 0 \
563 + _Complex_I)) Cfct, (Val)) \
564 (__typeof__ ((__tgmath_real_type (Val)) 0 \
565 + _Complex_I)) __tgml(Cfct) (Val)))
dfd2257a 566
58d87ee1
UD
567/* XXX This definition has to be changed as soon as the compiler understands
568 the imaginary keyword. */
be3a79a3 569# define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
2fee621d 570 (__extension__ ((sizeof (+__real__ (Val)) == sizeof (double) \
1c298d08 571 || __builtin_classify_type (__real__ (Val)) != 8) \
d9bef9c0 572 ? (__expr_is_real (Val) \
1c298d08
UD
573 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
574 Fct (Val) \
575 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
576 Cfct (Val)) \
2fee621d 577 : (sizeof (+__real__ (Val)) == sizeof (float)) \
d9bef9c0 578 ? (__expr_is_real (Val) \
1c298d08
UD
579 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
580 Fct##f (Val) \
581 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
582 Cfct##f (Val)) \
614d15f9
JM
583 : __TGMATH_CF128 ((Val), \
584 (__typeof__ \
585 (__real__ \
586 (__tgmath_real_type (Val)) 0)) Fct, \
587 (__typeof__ \
588 (__real__ \
589 (__tgmath_real_type (Val)) 0)) Cfct, \
590 (Val)) \
d9bef9c0 591 (__expr_is_real (Val) \
614d15f9
JM
592 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0)) \
593 __tgml(Fct) (Val) \
594 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0)) \
595 __tgml(Cfct) (Val))))
be3a79a3
JM
596# define __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME(Val, Cfct) \
597 __TGMATH_UNARY_REAL_IMAG_RET_REAL ((Val), Cfct, Cfct)
8a78f833 598# endif
58d87ee1 599
8a78f833 600# if !__HAVE_BUILTIN_TGMATH_C2X
48244d09
UD
601/* XXX This definition has to be changed as soon as the compiler understands
602 the imaginary keyword. */
be3a79a3 603# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
42df8d59
JM
604 (__extension__ ((sizeof (__real__ (Val1) \
605 + __real__ (Val2)) > sizeof (double) \
1c298d08
UD
606 && __builtin_classify_type (__real__ (Val1) \
607 + __real__ (Val2)) == 8) \
614d15f9 608 ? __TGMATH_CF128 ((Val1) + (Val2), \
8a78f833 609 (__tgmath_complex_type2 (Val1, Val2)) \
614d15f9 610 Fct, \
8a78f833 611 (__tgmath_complex_type2 (Val1, Val2)) \
614d15f9
JM
612 Cfct, \
613 (Val1, Val2)) \
d9bef9c0 614 (__expr_is_real ((Val1) + (Val2)) \
8a78f833 615 ? (__tgmath_complex_type2 (Val1, Val2)) \
614d15f9 616 __tgml(Fct) (Val1, Val2) \
8a78f833 617 : (__tgmath_complex_type2 (Val1, Val2)) \
614d15f9 618 __tgml(Cfct) (Val1, Val2)) \
2fee621d
JM
619 : (sizeof (+__real__ (Val1)) == sizeof (double) \
620 || sizeof (+__real__ (Val2)) == sizeof (double) \
1c298d08
UD
621 || __builtin_classify_type (__real__ (Val1)) != 8 \
622 || __builtin_classify_type (__real__ (Val2)) != 8) \
d9bef9c0 623 ? (__expr_is_real ((Val1) + (Val2)) \
8a78f833 624 ? (__tgmath_complex_type2 (Val1, Val2)) \
1c298d08 625 Fct (Val1, Val2) \
8a78f833 626 : (__tgmath_complex_type2 (Val1, Val2)) \
1c298d08 627 Cfct (Val1, Val2)) \
d9bef9c0 628 : (__expr_is_real ((Val1) + (Val2)) \
8a78f833 629 ? (__tgmath_complex_type2 (Val1, Val2)) \
1c298d08 630 Fct##f (Val1, Val2) \
8a78f833 631 : (__tgmath_complex_type2 (Val1, Val2)) \
1c298d08 632 Cfct##f (Val1, Val2))))
8a78f833 633# endif
f9fabc1b 634
8a78f833 635# if !__HAVE_BUILTIN_TGMATH
abd38358
JM
636# define __TGMATH_1_NARROW_F(F, X) \
637 (__extension__ (sizeof ((__tgmath_real_type (X)) 0) > sizeof (double) \
638 ? F ## l (X) \
639 : F (X)))
f9fabc1b
JM
640# define __TGMATH_2_NARROW_F(F, X, Y) \
641 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
642 + (__tgmath_real_type (Y)) 0) > sizeof (double) \
643 ? F ## l (X, Y) \
644 : F (X, Y)))
b3f27d81
JM
645# define __TGMATH_3_NARROW_F(F, X, Y, Z) \
646 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
647 + (__tgmath_real_type (Y)) 0 \
648 + (__tgmath_real_type (Z)) 0) > sizeof (double) \
649 ? F ## l (X, Y, Z) \
650 : F (X, Y, Z)))
8a78f833 651# endif
f9fabc1b
JM
652/* In most cases, these narrowing macro definitions based on sizeof
653 ensure that the function called has the right argument format, as
654 for other <tgmath.h> macros for compilers before GCC 8, but may not
655 have exactly the argument type (among the types with that format)
656 specified in the standard logic.
657
658 In the case of macros for _Float32x return type, when _Float64x
659 exists, _Float64 arguments should result in the *f64 function being
8a78f833
JM
660 called while _Float32x, float and double arguments should result in
661 the *f64x function being called (and integer arguments are
662 considered to have type _Float32x if any argument has type
663 _FloatNx, or double otherwise). These cases cannot be
664 distinguished using sizeof (or at all if the types are typedefs
665 rather than different types, in which case we err on the side of
666 using the wider type if unsure). */
667# if !__HAVE_BUILTIN_TGMATH_C2X
668# if __HAVE_FLOATN_NOT_TYPEDEF
669# define __TGMATH_NARROW_F32X_USE_F64X(X) \
670 !__builtin_types_compatible_p (__typeof (+(X)), _Float64)
671# else
672# define __TGMATH_NARROW_F32X_USE_F64X(X) \
673 (__builtin_types_compatible_p (__typeof (+(X)), double) \
674 || __builtin_types_compatible_p (__typeof (+(X)), float) \
675 || !__floating_type (__typeof (+(X))))
676# endif
677# endif
678# if __HAVE_FLOAT64X_LONG_DOUBLE && __HAVE_DISTINCT_FLOAT128
679# if !__HAVE_BUILTIN_TGMATH
abd38358
JM
680# define __TGMATH_1_NARROW_F32(F, X) \
681 (__extension__ (sizeof ((__tgmath_real_type (X)) 0) > sizeof (_Float64) \
8a78f833 682 ? __TGMATH_F128LD ((X), F, (X)) \
abd38358
JM
683 F ## f64x (X) \
684 : F ## f64 (X)))
f9fabc1b
JM
685# define __TGMATH_2_NARROW_F32(F, X, Y) \
686 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
687 + (__tgmath_real_type (Y)) 0) > sizeof (_Float64) \
8a78f833 688 ? __TGMATH_F128LD ((X) + (Y), F, (X, Y)) \
f9fabc1b
JM
689 F ## f64x (X, Y) \
690 : F ## f64 (X, Y)))
b3f27d81
JM
691# define __TGMATH_3_NARROW_F32(F, X, Y, Z) \
692 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
693 + (__tgmath_real_type (Y)) 0 \
694 + (__tgmath_real_type (Z)) 0) > sizeof (_Float64) \
8a78f833 695 ? __TGMATH_F128LD ((X) + (Y) + (Z), F, (X, Y, Z)) \
b3f27d81
JM
696 F ## f64x (X, Y, Z) \
697 : F ## f64 (X, Y, Z)))
abd38358
JM
698# define __TGMATH_1_NARROW_F64(F, X) \
699 (__extension__ (sizeof ((__tgmath_real_type (X)) 0) > sizeof (_Float64) \
8a78f833 700 ? __TGMATH_F128LD ((X), F, (X)) \
abd38358
JM
701 F ## f64x (X) \
702 : F ## f128 (X)))
f9fabc1b
JM
703# define __TGMATH_2_NARROW_F64(F, X, Y) \
704 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
705 + (__tgmath_real_type (Y)) 0) > sizeof (_Float64) \
8a78f833 706 ? __TGMATH_F128LD ((X) + (Y), F, (X, Y)) \
f9fabc1b
JM
707 F ## f64x (X, Y) \
708 : F ## f128 (X, Y)))
b3f27d81
JM
709# define __TGMATH_3_NARROW_F64(F, X, Y, Z) \
710 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
711 + (__tgmath_real_type (Y)) 0 \
712 + (__tgmath_real_type (Z)) 0) > sizeof (_Float64) \
8a78f833 713 ? __TGMATH_F128LD ((X) + (Y) + (Z), F, (X, Y, Z)) \
b3f27d81
JM
714 F ## f64x (X, Y, Z) \
715 : F ## f128 (X, Y, Z)))
8a78f833
JM
716# endif
717# if !__HAVE_BUILTIN_TGMATH_C2X
abd38358
JM
718# define __TGMATH_1_NARROW_F32X(F, X) \
719 (__extension__ (sizeof ((__tgmath_real_type (X)) 0) > sizeof (_Float64) \
8a78f833 720 || __TGMATH_NARROW_F32X_USE_F64X (X) \
abd38358
JM
721 ? __TGMATH_F128 ((X), F, (X)) \
722 F ## f64x (X) \
723 : F ## f64 (X)))
f9fabc1b
JM
724# define __TGMATH_2_NARROW_F32X(F, X, Y) \
725 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
726 + (__tgmath_real_type (Y)) 0) > sizeof (_Float64) \
8a78f833 727 || __TGMATH_NARROW_F32X_USE_F64X ((X) + (Y)) \
f9fabc1b
JM
728 ? __TGMATH_F128 ((X) + (Y), F, (X, Y)) \
729 F ## f64x (X, Y) \
730 : F ## f64 (X, Y)))
b3f27d81
JM
731# define __TGMATH_3_NARROW_F32X(F, X, Y, Z) \
732 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
733 + (__tgmath_real_type (Y)) 0 \
734 + (__tgmath_real_type (Z)) 0) > sizeof (_Float64) \
8a78f833 735 || __TGMATH_NARROW_F32X_USE_F64X ((X) + (Y) + (Z)) \
b3f27d81
JM
736 ? __TGMATH_F128 ((X) + (Y) + (Z), F, (X, Y, Z)) \
737 F ## f64x (X, Y, Z) \
738 : F ## f64 (X, Y, Z)))
8a78f833
JM
739# endif
740# elif __HAVE_FLOAT128
741# if !__HAVE_BUILTIN_TGMATH
abd38358
JM
742# define __TGMATH_1_NARROW_F32(F, X) \
743 (__extension__ (sizeof ((__tgmath_real_type (X)) 0) > sizeof (_Float64) \
744 ? F ## f128 (X) \
745 : F ## f64 (X)))
f9fabc1b
JM
746# define __TGMATH_2_NARROW_F32(F, X, Y) \
747 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
748 + (__tgmath_real_type (Y)) 0) > sizeof (_Float64) \
749 ? F ## f128 (X, Y) \
750 : F ## f64 (X, Y)))
b3f27d81
JM
751# define __TGMATH_3_NARROW_F32(F, X, Y, Z) \
752 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
753 + (__tgmath_real_type (Y)) 0 \
754 + (__tgmath_real_type (Z)) 0) > sizeof (_Float64) \
755 ? F ## f128 (X, Y, Z) \
756 : F ## f64 (X, Y, Z)))
abd38358
JM
757# define __TGMATH_1_NARROW_F64(F, X) \
758 (F ## f128 (X))
f9fabc1b
JM
759# define __TGMATH_2_NARROW_F64(F, X, Y) \
760 (F ## f128 (X, Y))
b3f27d81
JM
761# define __TGMATH_3_NARROW_F64(F, X, Y, Z) \
762 (F ## f128 (X, Y, Z))
8a78f833
JM
763# endif
764# if !__HAVE_BUILTIN_TGMATH_C2X
abd38358
JM
765# define __TGMATH_1_NARROW_F32X(F, X) \
766 (__extension__ (sizeof ((__tgmath_real_type (X)) 0) > sizeof (_Float32x) \
8a78f833 767 || __TGMATH_NARROW_F32X_USE_F64X (X) \
abd38358
JM
768 ? F ## f64x (X) \
769 : F ## f64 (X)))
f9fabc1b
JM
770# define __TGMATH_2_NARROW_F32X(F, X, Y) \
771 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
772 + (__tgmath_real_type (Y)) 0) > sizeof (_Float32x) \
8a78f833 773 || __TGMATH_NARROW_F32X_USE_F64X ((X) + (Y)) \
f9fabc1b
JM
774 ? F ## f64x (X, Y) \
775 : F ## f64 (X, Y)))
b3f27d81
JM
776# define __TGMATH_3_NARROW_F32X(F, X, Y, Z) \
777 (__extension__ (sizeof ((__tgmath_real_type (X)) 0 \
778 + (__tgmath_real_type (Y)) 0 \
779 + (__tgmath_real_type (Z)) 0) > sizeof (_Float32x) \
8a78f833 780 || __TGMATH_NARROW_F32X_USE_F64X ((X) + (Y) + (Z)) \
b3f27d81
JM
781 ? F ## f64x (X, Y, Z) \
782 : F ## f64 (X, Y, Z)))
8a78f833
JM
783# endif
784# else
785# if !__HAVE_BUILTIN_TGMATH
abd38358
JM
786# define __TGMATH_1_NARROW_F32(F, X) \
787 (F ## f64 (X))
f9fabc1b
JM
788# define __TGMATH_2_NARROW_F32(F, X, Y) \
789 (F ## f64 (X, Y))
b3f27d81
JM
790# define __TGMATH_3_NARROW_F32(F, X, Y, Z) \
791 (F ## f64 (X, Y, Z))
f9fabc1b 792# endif
8a78f833 793# endif
dfd2257a
UD
794#else
795# error "Unsupported compiler; you cannot use <tgmath.h>"
796#endif
797
798
799/* Unary functions defined for real and complex values. */
800
801
802/* Trigonometric functions. */
803
804/* Arc cosine of X. */
805#define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
806/* Arc sine of X. */
807#define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
808/* Arc tangent of X. */
809#define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
810/* Arc tangent of Y/X. */
cfb32a6c 811#define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2)
dfd2257a
UD
812
813/* Cosine of X. */
814#define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
815/* Sine of X. */
816#define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
817/* Tangent of X. */
818#define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
819
820
821/* Hyperbolic functions. */
822
823/* Hyperbolic arc cosine of X. */
824#define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
825/* Hyperbolic arc sine of X. */
826#define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
827/* Hyperbolic arc tangent of X. */
828#define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
829
830/* Hyperbolic cosine of X. */
831#define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
832/* Hyperbolic sine of X. */
833#define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
834/* Hyperbolic tangent of X. */
835#define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
836
837
838/* Exponential and logarithmic functions. */
839
840/* Exponential function of X. */
841#define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
842
843/* Break VALUE into a normalized fraction and an integral power of 2. */
844#define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
845
846/* X times (two to the EXP power). */
847#define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
848
849/* Natural logarithm of X. */
850#define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
851
852/* Base-ten logarithm of X. */
cc3fa755 853#ifdef __USE_GNU
0908a38a 854# define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, clog10)
cc3fa755
UD
855#else
856# define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
857#endif
dfd2257a
UD
858
859/* Return exp(X) - 1. */
860#define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
861
862/* Return log(1 + X). */
863#define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
864
865/* Return the base 2 signed integral exponent of X. */
866#define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
867
868/* Compute base-2 exponential of X. */
869#define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
870
871/* Compute base-2 logarithm of X. */
872#define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
873
52c057e3
JM
874#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C2X)
875/* Compute exponent to base ten. */
876#define exp10(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp10)
877#endif
878
dfd2257a
UD
879
880/* Power functions. */
881
882/* Return X to the Y power. */
883#define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
884
885/* Return the square root of X. */
886#define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
887
888/* Return `sqrt(X*X + Y*Y)'. */
889#define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
890
891/* Return the cube root of X. */
892#define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
893
894
895/* Nearest integer, absolute value, and remainder functions. */
896
897/* Smallest integral value not less than X. */
898#define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
899
900/* Absolute value of X. */
f1debaf6 901#define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs)
dfd2257a
UD
902
903/* Largest integer not greater than X. */
904#define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
905
906/* Floating-point modulo remainder of X/Y. */
907#define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
908
909/* Round X to integral valuein floating-point format using current
910 rounding direction, but do not raise inexact exception. */
911#define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
912
913/* Round X to nearest integral value, rounding halfway cases away from
914 zero. */
915#define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
916
917/* Round X to the integral value in floating-point format nearest but
918 not larger in magnitude. */
919#define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
920
921/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
922 and magnitude congruent `mod 2^n' to the magnitude of the integral
923 quotient x/y, with n >= 3. */
924#define remquo(Val1, Val2, Val3) \
925 __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
926
927/* Round X to nearest integral value according to current rounding
928 direction. */
cfa44345
JM
929#define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, lrint)
930#define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, llrint)
dfd2257a
UD
931
932/* Round X to nearest integral value, rounding halfway cases away from
933 zero. */
cfa44345
JM
934#define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, lround)
935#define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, llround)
dfd2257a
UD
936
937
938/* Return X with its signed changed to Y's. */
939#define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
940
941/* Error and gamma functions. */
942#define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
943#define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
00d8bc81 944#define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma)
dfd2257a
UD
945#define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
946
947
948/* Return the integer nearest X in the direction of the
949 prevailing rounding mode. */
950#define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
951
0175c9e9 952#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
41a359e2
RS
953/* Return X - epsilon. */
954# define nextdown(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextdown)
955/* Return X + epsilon. */
956# define nextup(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextup)
957#endif
958
dfd2257a
UD
959/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
960#define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
42bd0a85 961#define nexttoward(Val1, Val2) \
614d15f9 962 __TGMATH_BINARY_FIRST_REAL_STD_ONLY (Val1, Val2, nexttoward)
dfd2257a 963
7f0d9e61 964/* Return the remainder of integer division X / Y with infinite precision. */
dfd2257a
UD
965#define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
966
967/* Return X times (2 to the Nth power). */
de20571d 968#ifdef __USE_MISC
614d15f9 969# define scalb(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, scalb)
26644e87 970#endif
dfd2257a
UD
971
972/* Return X times (2 to the Nth power). */
973#define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
974
975/* Return X times (2 to the Nth power). */
976#define scalbln(Val1, Val2) \
977 __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
978
979/* Return the binary exponent of X, which must be nonzero. */
cfa44345 980#define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, ilogb)
dfd2257a
UD
981
982
983/* Return positive difference between X and Y. */
984#define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
985
9bd99786 986#if __GLIBC_USE (ISOC2X) && !defined __USE_GNU
dfd2257a 987/* Return maximum numeric value from X and Y. */
9bd99786 988# define fmax(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, fmax)
dfd2257a
UD
989
990/* Return minimum numeric value from X and Y. */
9bd99786
JM
991# define fmin(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, fmin)
992#else
993/* Return maximum numeric value from X and Y. */
994# define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
dfd2257a 995
9bd99786
JM
996/* Return minimum numeric value from X and Y. */
997# define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
998#endif
581c785b 999
dfd2257a 1000
bfce746a 1001/* Multiply-add function computed as a ternary operation. */
e7c3d12b 1002#define fma(Val1, Val2, Val3) \
bfce746a
UD
1003 __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
1004
0175c9e9 1005#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
41c67149
JM
1006/* Round X to nearest integer value, rounding halfway cases to even. */
1007# define roundeven(Val) __TGMATH_UNARY_REAL_ONLY (Val, roundeven)
1008
423c2b9d 1009# define fromfp(Val1, Val2, Val3) \
cfa44345 1010 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, fromfp)
423c2b9d
JM
1011
1012# define ufromfp(Val1, Val2, Val3) \
cfa44345 1013 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, ufromfp)
423c2b9d
JM
1014
1015# define fromfpx(Val1, Val2, Val3) \
cfa44345 1016 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, fromfpx)
423c2b9d
JM
1017
1018# define ufromfpx(Val1, Val2, Val3) \
cfa44345 1019 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, ufromfpx)
423c2b9d 1020
55a38f82 1021/* Like ilogb, but returning long int. */
cfa44345 1022# define llogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, llogb)
79850e10 1023#endif
55a38f82 1024
79850e10 1025#if __GLIBC_USE (IEC_60559_BFP_EXT)
525f8039
JM
1026/* Return value with maximum magnitude. */
1027# define fmaxmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaxmag)
1028
1029/* Return value with minimum magnitude. */
1030# define fminmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminmag)
0175c9e9 1031#endif
525f8039 1032
90f0ac10
JM
1033#if __GLIBC_USE (ISOC2X)
1034/* Return maximum value from X and Y. */
1035# define fmaximum(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaximum)
1036
1037/* Return minimum value from X and Y. */
1038# define fminimum(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminimum)
1039
1040/* Return maximum numeric value from X and Y. */
1041# define fmaximum_num(Val1, Val2) \
1042 __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaximum_num)
1043
1044/* Return minimum numeric value from X and Y. */
1045# define fminimum_num(Val1, Val2) \
1046 __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminimum_num)
1047
1048/* Return value with maximum magnitude. */
1049# define fmaximum_mag(Val1, Val2) \
1050 __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaximum_mag)
1051
1052/* Return value with minimum magnitude. */
1053# define fminimum_mag(Val1, Val2) \
1054 __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminimum_mag)
1055
1056/* Return numeric value with maximum magnitude. */
1057# define fmaximum_mag_num(Val1, Val2) \
1058 __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaximum_mag_num)
1059
1060/* Return numeric value with minimum magnitude. */
1061# define fminimum_mag_num(Val1, Val2) \
1062 __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminimum_mag_num)
1063#endif
1064
bfce746a 1065
dfd2257a
UD
1066/* Absolute value, conjugates, and projection. */
1067
1068/* Argument value of Z. */
be3a79a3 1069#define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME (Val, carg)
dfd2257a
UD
1070
1071/* Complex conjugate of Z. */
1c298d08 1072#define conj(Val) __TGMATH_UNARY_IMAG (Val, conj)
dfd2257a
UD
1073
1074/* Projection of Z onto the Riemann sphere. */
1c298d08 1075#define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj)
dfd2257a
UD
1076
1077
1078/* Decomposing complex values. */
1079
1080/* Imaginary part of Z. */
be3a79a3 1081#define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME (Val, cimag)
dfd2257a
UD
1082
1083/* Real part of Z. */
be3a79a3 1084#define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME (Val, creal)
dfd2257a 1085
f9fabc1b
JM
1086
1087/* Narrowing functions. */
1088
1089#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
1090
1091/* Add. */
1092# define fadd(Val1, Val2) __TGMATH_2_NARROW_F (fadd, Val1, Val2)
1093# define dadd(Val1, Val2) __TGMATH_2_NARROW_D (dadd, Val1, Val2)
1094
1095/* Divide. */
1096# define fdiv(Val1, Val2) __TGMATH_2_NARROW_F (fdiv, Val1, Val2)
1097# define ddiv(Val1, Val2) __TGMATH_2_NARROW_D (ddiv, Val1, Val2)
1098
1099/* Multiply. */
1100# define fmul(Val1, Val2) __TGMATH_2_NARROW_F (fmul, Val1, Val2)
1101# define dmul(Val1, Val2) __TGMATH_2_NARROW_D (dmul, Val1, Val2)
1102
1103/* Subtract. */
1104# define fsub(Val1, Val2) __TGMATH_2_NARROW_F (fsub, Val1, Val2)
1105# define dsub(Val1, Val2) __TGMATH_2_NARROW_D (dsub, Val1, Val2)
1106
abd38358
JM
1107/* Square root. */
1108# define fsqrt(Val) __TGMATH_1_NARROW_F (fsqrt, Val)
1109# define dsqrt(Val) __TGMATH_1_NARROW_D (dsqrt, Val)
1110
b3f27d81
JM
1111/* Fused multiply-add. */
1112# define ffma(Val1, Val2, Val3) __TGMATH_3_NARROW_F (ffma, Val1, Val2, Val3)
1113# define dfma(Val1, Val2, Val3) __TGMATH_3_NARROW_D (dfma, Val1, Val2, Val3)
1114
f9fabc1b
JM
1115#endif
1116
1117#if __GLIBC_USE (IEC_60559_TYPES_EXT)
1118
1119# if __HAVE_FLOAT16
1120# define f16add(Val1, Val2) __TGMATH_2_NARROW_F16 (f16add, Val1, Val2)
1121# define f16div(Val1, Val2) __TGMATH_2_NARROW_F16 (f16div, Val1, Val2)
1122# define f16mul(Val1, Val2) __TGMATH_2_NARROW_F16 (f16mul, Val1, Val2)
1123# define f16sub(Val1, Val2) __TGMATH_2_NARROW_F16 (f16sub, Val1, Val2)
abd38358 1124# define f16sqrt(Val) __TGMATH_1_NARROW_F16 (f16sqrt, Val)
b3f27d81
JM
1125# define f16fma(Val1, Val2, Val3) \
1126 __TGMATH_3_NARROW_F16 (f16fma, Val1, Val2, Val3)
f9fabc1b
JM
1127# endif
1128
1129# if __HAVE_FLOAT32
1130# define f32add(Val1, Val2) __TGMATH_2_NARROW_F32 (f32add, Val1, Val2)
1131# define f32div(Val1, Val2) __TGMATH_2_NARROW_F32 (f32div, Val1, Val2)
1132# define f32mul(Val1, Val2) __TGMATH_2_NARROW_F32 (f32mul, Val1, Val2)
1133# define f32sub(Val1, Val2) __TGMATH_2_NARROW_F32 (f32sub, Val1, Val2)
abd38358 1134# define f32sqrt(Val) __TGMATH_1_NARROW_F32 (f32sqrt, Val)
b3f27d81
JM
1135# define f32fma(Val1, Val2, Val3) \
1136 __TGMATH_3_NARROW_F32 (f32fma, Val1, Val2, Val3)
f9fabc1b
JM
1137# endif
1138
1139# if __HAVE_FLOAT64 && (__HAVE_FLOAT64X || __HAVE_FLOAT128)
1140# define f64add(Val1, Val2) __TGMATH_2_NARROW_F64 (f64add, Val1, Val2)
1141# define f64div(Val1, Val2) __TGMATH_2_NARROW_F64 (f64div, Val1, Val2)
1142# define f64mul(Val1, Val2) __TGMATH_2_NARROW_F64 (f64mul, Val1, Val2)
1143# define f64sub(Val1, Val2) __TGMATH_2_NARROW_F64 (f64sub, Val1, Val2)
abd38358 1144# define f64sqrt(Val) __TGMATH_1_NARROW_F64 (f64sqrt, Val)
b3f27d81
JM
1145# define f64fma(Val1, Val2, Val3) \
1146 __TGMATH_3_NARROW_F64 (f64fma, Val1, Val2, Val3)
f9fabc1b
JM
1147# endif
1148
1149# if __HAVE_FLOAT32X
1150# define f32xadd(Val1, Val2) __TGMATH_2_NARROW_F32X (f32xadd, Val1, Val2)
1151# define f32xdiv(Val1, Val2) __TGMATH_2_NARROW_F32X (f32xdiv, Val1, Val2)
1152# define f32xmul(Val1, Val2) __TGMATH_2_NARROW_F32X (f32xmul, Val1, Val2)
1153# define f32xsub(Val1, Val2) __TGMATH_2_NARROW_F32X (f32xsub, Val1, Val2)
abd38358 1154# define f32xsqrt(Val) __TGMATH_1_NARROW_F32X (f32xsqrt, Val)
b3f27d81
JM
1155# define f32xfma(Val1, Val2, Val3) \
1156 __TGMATH_3_NARROW_F32X (f32xfma, Val1, Val2, Val3)
f9fabc1b
JM
1157# endif
1158
1159# if __HAVE_FLOAT64X && (__HAVE_FLOAT128X || __HAVE_FLOAT128)
1160# define f64xadd(Val1, Val2) __TGMATH_2_NARROW_F64X (f64xadd, Val1, Val2)
1161# define f64xdiv(Val1, Val2) __TGMATH_2_NARROW_F64X (f64xdiv, Val1, Val2)
1162# define f64xmul(Val1, Val2) __TGMATH_2_NARROW_F64X (f64xmul, Val1, Val2)
1163# define f64xsub(Val1, Val2) __TGMATH_2_NARROW_F64X (f64xsub, Val1, Val2)
abd38358 1164# define f64xsqrt(Val) __TGMATH_1_NARROW_F64X (f64xsqrt, Val)
b3f27d81
JM
1165# define f64xfma(Val1, Val2, Val3) \
1166 __TGMATH_3_NARROW_F64X (f64xfma, Val1, Val2, Val3)
f9fabc1b
JM
1167# endif
1168
1169#endif
1170
dfd2257a 1171#endif /* tgmath.h */