diff options
| author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-21 01:28:58 +0000 |
|---|---|---|
| committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-21 01:28:58 +0000 |
| commit | 5ce8da41186c2b7f5cc76dc9b7d03a934814a00b (patch) | |
| tree | 61badc342d3eb229c3bff772c8045fd228faff42 /libstdc++-v3/include/bits/std_complex.h | |
| parent | 615166bb45272b0ad86b04ff1a7d65770ed5f4f9 (diff) | |
| download | ppe42-gcc-5ce8da41186c2b7f5cc76dc9b7d03a934814a00b.tar.gz ppe42-gcc-5ce8da41186c2b7f5cc76dc9b7d03a934814a00b.zip | |
* src/Makefile.am (sources): Remove complex.cc, complexf.cc and
complexl.cc from list.
* src/Makefile.in: Regenerate.
* src/complex.cc: Remove.
* src/complexf.cc: Likewise.
* src/complexl.cc: Likewise.
* libmath/Makefile.am (EXTRA_LONG_DOUBLE_yes): Remove csqrtl.c
(EXTRA_DIST): Remove csqrt.c and csqrtf.c.
* libmath/Makefile.in: Regenerate.
* libmath/complex-stub.h: Remove.
* libmath/csqrt.c: Likewise.
* libmath/sqrtf.c: Likewise.
* libmath/sqrtl.c: Likewise.
* libmath/mathconf.h: Remove <complex.h> and "complex-stub.h"
#inclusion.
* include/bits/std_complex.h (sqrt<>): Define primary template.
(complex<>): Remove sqrt friend declarations.
* configure.in: Initialize with src/ios.cc.
* configure: Regenerate.
* acinclude.m4: Remove check for csqrt* and <complex.h>
* aclocal.m4: Regenerate.
* config.h.in: Regenerate.
* Makefile.in: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38409 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/std_complex.h')
| -rw-r--r-- | libstdc++-v3/include/bits/std_complex.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libstdc++-v3/include/bits/std_complex.h b/libstdc++-v3/include/bits/std_complex.h index 136ecb458f3..18e1b02b165 100644 --- a/libstdc++-v3/include/bits/std_complex.h +++ b/libstdc++-v3/include/bits/std_complex.h @@ -451,6 +451,28 @@ namespace std } template<typename _Tp> + complex<_Tp> + sqrt(const complex<_Tp>& __z) + { + _Tp __x = __z.real(); + _Tp __y = __z.imag(); + + if (__x == _Tp()) + { + _Tp __t = sqrt(abs(__y) / 2); + return complex<_Tp>(__t, __y < _Tp() ? -__t : __t); + } + else + { + _Tp __t = sqrt( 2 * abs(__z) + abs(__x)); + _Tp __u = __t / 2; + return __x > _Tp() + ? complex<_Tp>(__u, __y / __t) + : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u); + } + } + + template<typename _Tp> inline complex<_Tp> tan(const complex<_Tp>& __z) { @@ -537,8 +559,6 @@ namespace std friend class complex<double>; friend class complex<long double>; - - friend complex<float> sqrt<>(const complex<float>&); }; inline float @@ -685,8 +705,6 @@ namespace std friend class complex<float>; friend class complex<long double>; - - friend complex<double> sqrt<>(const complex<double>&); }; inline double @@ -833,8 +851,6 @@ namespace std friend class complex<float>; friend class complex<double>; - - friend complex<long double> sqrt<>(const complex<long double>&); }; inline |

