1/** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6/* 7 * complex.h 8 * 9 * This file is part of the Mingw32 package. 10 * 11 * Contributors: 12 * Created by Danny Smith <dannysmith@users.sourceforge.net> 13 * 14 * THIS SOFTWARE IS NOT COPYRIGHTED 15 * 16 * This source code is offered for use in the public domain. You may 17 * use, modify or distribute it freely. 18 * 19 * This code is distributed in the hope that it will be useful but 20 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 21 * DISCLAIMED. This includes but is not limited to warranties of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 23 * 24 */ 25 26#ifndef _COMPLEX_H_ 27#define _COMPLEX_H_ 28 29/* All the headers include this file. */ 30#include <crtdefs.h> 31 32/* These macros are specified by C99 standard */ 33 34#ifndef __cplusplus 35#define complex _Complex 36#endif 37 38#define _Complex_I (__extension__ 1.0iF) 39 40/* GCC doesn't support _Imaginary type yet, so we don't 41 define _Imaginary_I */ 42 43#define I _Complex_I 44 45#ifdef __cplusplus 46extern "C" { 47#endif 48 49#ifndef RC_INVOKED 50 51double __MINGW_ATTRIB_CONST creal (double _Complex); 52double __MINGW_ATTRIB_CONST cimag (double _Complex); 53double __MINGW_ATTRIB_CONST carg (double _Complex); 54double __MINGW_ATTRIB_CONST cabs (double _Complex) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 55double _Complex __MINGW_ATTRIB_CONST conj (double _Complex); 56double _Complex cacos (double _Complex); 57double _Complex casin (double _Complex); 58double _Complex catan (double _Complex); 59double _Complex ccos (double _Complex); 60double _Complex csin (double _Complex); 61double _Complex ctan (double _Complex); 62double _Complex cacosh (double _Complex); 63double _Complex casinh (double _Complex); 64double _Complex catanh (double _Complex); 65double _Complex ccosh (double _Complex); 66double _Complex csinh (double _Complex); 67double _Complex ctanh (double _Complex); 68double _Complex cexp (double _Complex); 69double _Complex clog (double _Complex); 70double _Complex cpow (double _Complex, double _Complex); 71double _Complex csqrt (double _Complex); 72double _Complex __MINGW_ATTRIB_CONST cproj (double _Complex); 73 74float __MINGW_ATTRIB_CONST crealf (float _Complex); 75float __MINGW_ATTRIB_CONST cimagf (float _Complex); 76float __MINGW_ATTRIB_CONST cargf (float _Complex); 77float __MINGW_ATTRIB_CONST cabsf (float _Complex); 78float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex); 79float _Complex cacosf (float _Complex); 80float _Complex casinf (float _Complex); 81float _Complex catanf (float _Complex); 82float _Complex ccosf (float _Complex); 83float _Complex csinf (float _Complex); 84float _Complex ctanf (float _Complex); 85float _Complex cacoshf (float _Complex); 86float _Complex casinhf (float _Complex); 87float _Complex catanhf (float _Complex); 88float _Complex ccoshf (float _Complex); 89float _Complex csinhf (float _Complex); 90float _Complex ctanhf (float _Complex); 91float _Complex cexpf (float _Complex); 92float _Complex clogf (float _Complex); 93float _Complex cpowf (float _Complex, float _Complex); 94float _Complex csqrtf (float _Complex); 95float _Complex __MINGW_ATTRIB_CONST cprojf (float _Complex); 96 97long double __MINGW_ATTRIB_CONST creall (long double _Complex); 98long double __MINGW_ATTRIB_CONST cimagl (long double _Complex); 99long double __MINGW_ATTRIB_CONST cargl (long double _Complex); 100long double __MINGW_ATTRIB_CONST cabsl (long double _Complex); 101long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex); 102long double _Complex cacosl (long double _Complex); 103long double _Complex casinl (long double _Complex); 104long double _Complex catanl (long double _Complex); 105long double _Complex ccosl (long double _Complex); 106long double _Complex csinl (long double _Complex); 107long double _Complex ctanl (long double _Complex); 108long double _Complex cacoshl (long double _Complex); 109long double _Complex casinhl (long double _Complex); 110long double _Complex catanhl (long double _Complex); 111long double _Complex ccoshl (long double _Complex); 112long double _Complex csinhl (long double _Complex); 113long double _Complex ctanhl (long double _Complex); 114long double _Complex cexpl (long double _Complex); 115long double _Complex clogl (long double _Complex); 116long double _Complex cpowl (long double _Complex, long double _Complex); 117long double _Complex csqrtl (long double _Complex); 118long double _Complex __MINGW_ATTRIB_CONST cprojl (long double _Complex); 119 120#ifdef __GNUC__ 121#if !defined (__CRT__NO_INLINE) && defined (_MATH_H_) 122/* double */ 123__CRT_INLINE double __MINGW_ATTRIB_CONST creal (double _Complex _Z) 124{ 125 return __real__ _Z; 126} 127 128__CRT_INLINE double __MINGW_ATTRIB_CONST cimag (double _Complex _Z) 129{ 130 return __imag__ _Z; 131} 132 133__CRT_INLINE double _Complex __MINGW_ATTRIB_CONST conj (double _Complex _Z) 134{ 135 return __extension__ ~_Z; 136} 137 138__CRT_INLINE double __MINGW_ATTRIB_CONST carg (double _Complex _Z) 139{ 140 return atan2 (__imag__ _Z, __real__ _Z); 141} 142 143__CRT_INLINE double __MINGW_ATTRIB_CONST cabs (double _Complex _Z) 144{ 145 return hypot (__real__ _Z, __imag__ _Z); 146} 147 148/* float */ 149__CRT_INLINE float __MINGW_ATTRIB_CONST crealf (float _Complex _Z) 150{ 151 return __real__ _Z; 152} 153 154__CRT_INLINE float __MINGW_ATTRIB_CONST cimagf (float _Complex _Z) 155{ 156 return __imag__ _Z; 157} 158 159__CRT_INLINE float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex _Z) 160{ 161 return __extension__ ~_Z; 162} 163 164__CRT_INLINE float __MINGW_ATTRIB_CONST cargf (float _Complex _Z) 165{ 166 return atan2f (__imag__ _Z, __real__ _Z); 167} 168 169__CRT_INLINE float __MINGW_ATTRIB_CONST cabsf (float _Complex _Z) 170{ 171 return hypotf (__real__ _Z, __imag__ _Z); 172} 173 174/* long double */ 175__CRT_INLINE long double __MINGW_ATTRIB_CONST creall (long double _Complex _Z) 176{ 177 return __real__ _Z; 178} 179 180__CRT_INLINE long double __MINGW_ATTRIB_CONST cimagl (long double _Complex _Z) 181{ 182 return __imag__ _Z; 183} 184 185__CRT_INLINE long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex _Z) 186{ 187 return __extension__ ~_Z; 188} 189 190__CRT_INLINE long double __MINGW_ATTRIB_CONST cargl (long double _Complex _Z) 191{ 192 return atan2l (__imag__ _Z, __real__ _Z); 193} 194 195__CRT_INLINE long double __MINGW_ATTRIB_CONST cabsl (long double _Complex _Z) 196{ 197 return hypotl (__real__ _Z, __imag__ _Z); 198} 199#endif /* !__CRT__NO_INLINE */ 200#endif /* __GNUC__ */ 201 202 203#endif /* RC_INVOKED */ 204 205#ifdef __cplusplus 206} 207#endif 208 209#endif /* _COMPLEX_H */ 210