| 1 | /*===-- lib/quadmath/complex-math.h ---------------------------------*- C -*-=== |
| 2 | * |
| 3 | * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | * See https://llvm.org/LICENSE.txt for license information. |
| 5 | * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | * |
| 7 | *===----------------------------------------------------------------------===*/ |
| 8 | |
| 9 | #ifndef FLANG_RT_QUADMATH_COMPLEX_MATH_H_ |
| 10 | #define FLANG_RT_QUADMATH_COMPLEX_MATH_H_ |
| 11 | |
| 12 | #include "flang/Common/float128.h" |
| 13 | #include "flang/Runtime/entry-names.h" |
| 14 | |
| 15 | #if HAS_QUADMATHLIB |
| 16 | #include "quadmath_wrapper.h" |
| 17 | #define CAbs(x) cabsq(x) |
| 18 | #define CAcos(x) cacosq(x) |
| 19 | #define CAcosh(x) cacoshq(x) |
| 20 | #define CAsin(x) casinq(x) |
| 21 | #define CAsinh(x) casinhq(x) |
| 22 | #define CAtan(x) catanq(x) |
| 23 | #define CAtanh(x) catanhq(x) |
| 24 | #define CCos(x) ccosq(x) |
| 25 | #define CCosh(x) ccoshq(x) |
| 26 | #define CExp(x) cexpq(x) |
| 27 | #define CLog(x) clogq(x) |
| 28 | #define CPow(x, p) cpowq(x, p) |
| 29 | #define CSin(x) csinq(x) |
| 30 | #define CSinh(x) csinhq(x) |
| 31 | #define CSqrt(x) csqrtq(x) |
| 32 | #define CTan(x) ctanq(x) |
| 33 | #define CTanh(x) ctanhq(x) |
| 34 | #elif HAS_LDBL128 |
| 35 | /* Use 'long double' versions of libm functions. */ |
| 36 | #include <complex.h> |
| 37 | |
| 38 | #define CAbs(x) cabsl(x) |
| 39 | #define CAcos(x) cacosl(x) |
| 40 | #define CAcosh(x) cacoshl(x) |
| 41 | #define CAsin(x) casinl(x) |
| 42 | #define CAsinh(x) casinhl(x) |
| 43 | #define CAtan(x) catanl(x) |
| 44 | #define CAtanh(x) catanhl(x) |
| 45 | #define CCos(x) ccosl(x) |
| 46 | #define CCosh(x) ccoshl(x) |
| 47 | #define CExp(x) cexpl(x) |
| 48 | #define CLog(x) clogl(x) |
| 49 | #define CPow(x, p) cpowl(x, p) |
| 50 | #define CSin(x) csinl(x) |
| 51 | #define CSinh(x) csinhl(x) |
| 52 | #define CSqrt(x) csqrtl(x) |
| 53 | #define CTan(x) ctanl(x) |
| 54 | #define CTanh(x) ctanhl(x) |
| 55 | #elif HAS_LIBMF128 |
| 56 | /* We can use __float128 versions of libm functions. |
| 57 | * __STDC_WANT_IEC_60559_TYPES_EXT__ needs to be defined |
| 58 | * before including math.h to enable the *f128 prototypes. */ |
| 59 | #error "Float128Math build with glibc>=2.26 is unsupported yet" |
| 60 | #endif |
| 61 | |
| 62 | #endif /* FLANG_RT_QUADMATH_COMPLEX_MATH_H_ */ |
| 63 | |