From: Danny Smith <dannysmith@cl...>  20030704 08:13:42

 Original Message  From: "Luke Dunstan" <coder_infidel> From: "Danny Smith" <dannysmith > > > > Do we have any complex number guru's here. I've been running into > > warnings from GCC trunk with the declaration of cabs() in math.h. GCC > > has a builtin type __complex__(_Complex in C99) which is equivalent to > > MS _complex struct for doubles and it warns that the builtin function > > cabs is different from the math.h declaration. > > > > That made me look at the ISO C99 doc's for complex.h, and I think that > > complex support is mingw is doable  many of the functions are trivial, > > esp with builtin GCC support for complex  but getting optimized > > versions of complex trig functions is beyond me without considerable > > research. > > I don't know about optimising them but libstdc++'s <complex> header has all > the functions you need, e.g.: > > template<typename _Tp> > inline complex<_Tp> > cos(const complex<_Tp>& __z) > { > const _Tp __x = __z.real(); > const _Tp __y = __z.imag(); > return complex<_Tp>(cos(__x) * cosh(__y), sin(__x) * sinh(__y)); > } > Ya, I know about those, so do my old university lecture notes. Handling the special cases (NaNs, Infs, denormals) and setting errno needs to be added for most functions. Also I expect that something like above loses precision. How much? There must be some PD testsuites for these somewhere. Danny 