home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / xcomplex < prev    next >
Text File  |  1998-06-16  |  25KB  |  538 lines

  1. // xcomplex internal header
  2.  
  3. #if     _MSC_VER > 1000
  4. #pragma once
  5. #endif
  6.  
  7. #ifndef _XCOMPLEX_
  8. #define _XCOMPLEX_
  9.  
  10.         // TEMPLATE FUNCTION imag
  11. _TMPLT(_Ty) inline
  12.     _Ty __cdecl imag(const _CMPLX(_Ty)& _X)
  13.     {return (_X.imag()); }
  14.         // TEMPLATE FUNCTION real
  15. _TMPLT(_Ty) inline
  16.     _Ty __cdecl real(const _CMPLX(_Ty)& _X)
  17.     {return (_X.real()); }
  18.         // TEMPLATE FUNCTION _Fabs
  19. _TMPLT(_Ty) inline
  20.     _Ty __cdecl _Fabs(const _CMPLX(_Ty)& _X, int *_Pexp)
  21.     {*_Pexp = 0;
  22.     _Ty _A = real(_X);
  23.     _Ty _B = imag(_X);
  24.     if (_CTR(_Ty)::_Isnan(_A))
  25.         return (_A);
  26.     else if (_CTR(_Ty)::_Isnan(_B))
  27.         return (_B);
  28.     else
  29.         {if (_A < 0)
  30.             _A = -_A;
  31.         if (_B < 0)
  32.             _B = -_B;
  33.         if (_A < _B)
  34.             {_Ty _W = _A;
  35.             _A = _B, _B = _W; }
  36.         if (_A == 0 || _CTR(_Ty)::_Isinf(_A))
  37.             return (_A);
  38.         if (1 <= _A)
  39.             *_Pexp = 2, _A = _A * 0.25, _B = _B * 0.25;
  40.         else
  41.             *_Pexp = -2, _A = _A * 4, _B = _B * 4;
  42.         _Ty _W = _A - _B;
  43.         if (_W == _A)
  44.             return (_A);
  45.         else if (_B < _W)
  46.             {const _Ty _Q = _A / _B;
  47.             return (_A + _B
  48.                 / (_Q + _CTR(_Ty)::sqrt(_Q * _Q + 1))); }
  49.         else
  50.             {static const _Ty _R2 = (const _Ty)1.4142135623730950488L;
  51.             static const _Ty _Xh = (const _Ty)2.4142L;
  52.             static const _Ty _Xl = (const _Ty)0.0000135623730950488016887L;
  53.             const _Ty _Q = _W / _B;
  54.             const _Ty _R = (_Q + 2) * _Q;
  55.             const _Ty _S = _R / (_R2 + _CTR(_Ty)::sqrt(_R + 2))
  56.                 + _Xl + _Q + _Xh;
  57.             return (_A + _B / _S); }}}
  58.         // TEMPLATE FUNCTION operator+
  59. _TMPLT(_Ty) inline
  60.     _CMPLX(_Ty) __cdecl operator+(const _CMPLX(_Ty)& _L,
  61.         const _CMPLX(_Ty)& _R)
  62.     {_CMPLX(_Ty) _W(_L);
  63.     return (_W += _R); }
  64. _TMPLT(_Ty) inline
  65.     _CMPLX(_Ty) __cdecl operator+(const _CMPLX(_Ty)& _L, const _Ty& _R)
  66.     {_CMPLX(_Ty) _W(_L);
  67.     _W.real(_W.real() + _R);
  68.     return (_W); }
  69. _TMPLT(_Ty) inline
  70.     _CMPLX(_Ty) __cdecl operator+(const _Ty& _L, const _CMPLX(_Ty)& _R)
  71.     {_CMPLX(_Ty) _W(_L);
  72.     return (_W += _R); }
  73.         // TEMPLATE FUNCTION operator-
  74. _TMPLT(_Ty) inline
  75.     _CMPLX(_Ty) __cdecl operator-(const _CMPLX(_Ty)& _L,
  76.         const _CMPLX(_Ty)& _R)
  77.     {_CMPLX(_Ty) _W(_L);
  78.     return (_W -= _R); }
  79. _TMPLT(_Ty) inline
  80.     _CMPLX(_Ty) __cdecl operator-(const _CMPLX(_Ty)& _L, const _Ty& _R)
  81.     {_CMPLX(_Ty) _W(_L);
  82.     _W.real(_W.real() - _R);
  83.     return (_W); }
  84. _TMPLT(_Ty) inline
  85.     _CMPLX(_Ty) __cdecl operator-(const _Ty& _L, const _CMPLX(_Ty)& _R)
  86.     {_CMPLX(_Ty) _W(_L);
  87.     return (_W -= _R); }
  88.         // TEMPLATE FUNCTION operator*
  89. _TMPLT(_Ty) inline
  90.     _CMPLX(_Ty) __cdecl operator*(const _CMPLX(_Ty)& _L,
  91.         const _CMPLX(_Ty)& _R)
  92.     {_CMPLX(_Ty) _W(_L);
  93.     return (_W *= _R); }
  94. _TMPLT(_Ty) inline
  95.     _CMPLX(_Ty) __cdecl operator*(const _CMPLX(_Ty)& _L, const _Ty& _R)
  96.     {_CMPLX(_Ty) _W(_L);
  97.     _W.real(_W.real() * _R);
  98.     _W.imag(_W.imag() * _R);
  99.     return (_W); }
  100. _TMPLT(_Ty) inline
  101.     _CMPLX(_Ty) __cdecl operator*(const _Ty& _L, const _CMPLX(_Ty)& _R)
  102.     {_CMPLX(_Ty) _W(_L);
  103.     return (_W *= _R); }
  104.         // TEMPLATE FUNCTION operator/
  105. _TMPLT(_Ty) inline
  106.     _CMPLX(_Ty) __cdecl operator/(const _CMPLX(_Ty)& _L,
  107.         const _CMPLX(_Ty)& _R)
  108.     {_CMPLX(_Ty) _W(_L);
  109.     return (_W /= _R); }
  110. _TMPLT(_Ty) inline
  111.     _CMPLX(_Ty) __cdecl operator/(const _CMPLX(_Ty)& _L, const _Ty& _R)
  112.     {_CMPLX(_Ty) _W(_L);
  113.     _W.real(_W.real() / _R);
  114.     _W.imag(_W.imag() / _R);
  115.     return (_W); }
  116. _TMPLT(_Ty) inline
  117.     _CMPLX(_Ty) __cdecl operator/(const _Ty& _L, const _CMPLX(_Ty)& _R)
  118.     {_CMPLX(_Ty) _W(_L);
  119.     return (_W /= _R); }
  120.         // TEMPLATE FUNCTION UNARY operator+
  121. _TMPLT(_Ty) inline
  122.     _CMPLX(_Ty) __cdecl operator+(const _CMPLX(_Ty)& _L)
  123.     {return (_CMPLX(_Ty)(_L)); }
  124.         // TEMPLATE FUNCTION UNARY operator-
  125. _TMPLT(_Ty) inline
  126.     _CMPLX(_Ty) __cdecl operator-(const _CMPLX(_Ty)& _L)
  127.     {return (_CMPLX(_Ty)(-real(_L), -imag(_L))); }
  128.         // TEMPLATE FUNCTION operator==
  129. _TMPLT(_Ty) inline
  130.     bool __cdecl operator==(const _CMPLX(_Ty)& _L, const _CMPLX(_Ty)& _R)
  131.     {return (real(_L) == real(_R) && imag(_L) == imag(_R)); }
  132. _TMPLT(_Ty) inline
  133.     bool __cdecl operator==(const _CMPLX(_Ty)& _L, const _Ty& _R)
  134.     {return (real(_L) == _R && imag(_L) == 0); }
  135. _TMPLT(_Ty) inline
  136.     bool __cdecl operator==(const _Ty& _L, const _CMPLX(_Ty)& _R)
  137.     {return (_L == real(_R) && 0 == imag(_R)); }
  138. _TMPLT(_Ty) inline
  139.     bool __cdecl operator!=(const _CMPLX(_Ty)& _L, const _CMPLX(_Ty)& _R)
  140.     {return (!(_L == _R)); }
  141. _TMPLT(_Ty) inline
  142.     bool __cdecl operator!=(const _CMPLX(_Ty)& _L, const _Ty& _R)
  143.     {return (!(_L == _R)); }
  144. _TMPLT(_Ty) inline
  145.     bool __cdecl operator!=(const _Ty& _L, const _CMPLX(_Ty)& _R)
  146.     {return (!(_L == _R)); }
  147.         // TEMPLATE FUNCTION abs
  148. _TMPLT(_Ty) inline
  149.     _Ty __cdecl abs(const _CMPLX(_Ty)& _X)
  150.     {int _Xexp;
  151.     _Ty _Rho = _Fabs(_X, &_Xexp);
  152.     if (_Xexp == 0)
  153.         return (_Rho);
  154.     else
  155.         return (_CTR(_Ty)::ldexp(_Rho, _Xexp)); }
  156.         // TEMPLATE FUNCTION arg
  157. _TMPLT(_Ty) inline
  158.     _Ty __cdecl arg(const _CMPLX(_Ty)& _X)
  159.     {return (_CTR(_Ty)::atan2(imag(_X), real(_X))); }
  160.         // TEMPLATE FUNCTION conjg
  161. _TMPLT(_Ty) inline
  162.     _CMPLX(_Ty) __cdecl conj(const _CMPLX(_Ty)& _X)
  163.     {return (_CMPLX(_Ty)(real(_X), -imag(_X))); }
  164.         // TEMPLATE FUNCTION cos
  165. _TMPLT(_Ty) inline
  166.     _CMPLX(_Ty) __cdecl cos(const _CMPLX(_Ty)& _X)
  167.     {return (_CMPLX(_Ty)(
  168.         _CTR(_Ty)::_Cosh(imag(_X), _CTR(_Ty)::cos(real(_X))),
  169.         -_CTR(_Ty)::_Sinh(imag(_X),
  170.             _CTR(_Ty)::sin(real(_X))))); }
  171.         // TEMPLATE FUNCTION cosh
  172. _TMPLT(_Ty) inline
  173.     _CMPLX(_Ty) __cdecl cosh(const _CMPLX(_Ty)& _X)
  174.     {return (_CMPLX(_Ty)(
  175.         _CTR(_Ty)::_Cosh(real(_X), _CTR(_Ty)::cos(imag(_X))),
  176.         _CTR(_Ty)::_Sinh(real(_X), _CTR(_Ty)::sin(imag(_X))))); }
  177.         // TEMPLATE FUNCTION exp
  178. _TMPLT(_Ty) inline
  179.     _CMPLX(_Ty) __cdecl exp(const _CMPLX(_Ty)& _X)
  180.     {_Ty _Re(real(_X)), _Im(real(_X));
  181.     _CTR(_Ty)::_Exp(&_Re, _CTR(_Ty)::cos(imag(_X)), 0);
  182.     _CTR(_Ty)::_Exp(&_Im, _CTR(_Ty)::sin(imag(_X)), 0);
  183.     return (_CMPLX(_Ty)(_Re, _Im)); }
  184.         // TEMPLATE FUNCTION log
  185. _TMPLT(_Ty) inline
  186.     _CMPLX(_Ty) __cdecl log(const _CMPLX(_Ty)& _X)
  187.     {int _Xexp;
  188.     _Ty _Rho = _Fabs(_X, &_Xexp);
  189.     if (_CTR(_Ty)::_Isnan(_Rho))
  190.         return (_CMPLX(_Ty)(_Rho, _Rho));
  191.     else
  192.         {static const _Ty _Cm = 22713.0 / 32768.0;
  193.         static const _Ty _Cl = (const _Ty)1.428606820309417232e-6L;
  194.         _Ty _Xn = _Xexp;
  195.         _CMPLX(_Ty) _W(_Rho == 0 ? -_CTR(_Ty)::_Infv(_Rho)
  196.             : _CTR(_Ty)::_Isinf(_Rho) ? _Rho
  197.             : _CTR(_Ty)::log(_Rho) + _Xn * _Cl + _Xn * _Cm,
  198.                 _CTR(_Ty)::atan2(imag(_X), real(_X)));
  199.         return (_W); }}
  200.         // TEMPLATE FUNCTION log10
  201. _TMPLT(_Ty) inline
  202.     _CMPLX(_Ty) __cdecl log10(const _CMPLX(_Ty)& _X)
  203.     {return (log(_X) * (_Ty)0.4342944819032518276511289L); }
  204.         // TEMPLATE FUNCTION norm
  205. _TMPLT(_Ty) inline
  206.     _Ty __cdecl norm(const _CMPLX(_Ty)& _X)
  207.     {return (real(_X) * real(_X) + imag(_X) * imag(_X)); }
  208.         // TEMPLATE FUNCTION polar
  209. _TMPLT(_Ty) inline
  210.     _CMPLX(_Ty) __cdecl polar(const _Ty& _Rho, const _Ty& _Theta)
  211.     {return (_CMPLX(_Ty)(_Rho * _CTR(_Ty)::cos(_Theta),
  212.         _Rho * _CTR(_Ty)::sin(_Theta))); }
  213. _TMPLT(_Ty) inline
  214.     _CMPLX(_Ty) __cdecl polar(const _Ty& _Rho)
  215.     {return (polar(_Rho, (_Ty)0)); }
  216.         // TEMPLATE FUNCTION pow
  217. _TMPLT(_Ty) inline
  218.     _CMPLX(_Ty) __cdecl pow(const _CMPLX(_Ty)& _X,
  219.         const _CMPLX(_Ty)& _Y)
  220.     {if (imag(_Y) == 0)
  221.         return (pow(_X, real(_Y)));
  222.     else if (imag(_X) == 0)
  223.         return (_CMPLX(_Ty)(pow(real(_X), _Y)));
  224.     else
  225.         return (exp(_Y * log(_X))); }
  226. _TMPLT(_Ty) inline
  227.     _CMPLX(_Ty) __cdecl pow(const _CMPLX(_Ty)& _X, const _Ty& _Y)
  228.     {if (imag(_X) == 0)
  229.         return (_CMPLX(_Ty)(_CTR(_Ty)::pow(real(_X), _Y)));
  230.     else
  231.         return (exp(_Y * log(_X))); }
  232. _TMPLT(_Ty) inline
  233.     _CMPLX(_Ty) __cdecl pow(const _CMPLX(_Ty)& _X, int _Y)
  234.     {if (imag(_X) == 0)
  235.         return (_CMPLX(_Ty)(_CTR(_Ty)::pow(real(_X), _Y)));
  236.     else
  237.         return (_Pow_int(_CMPLX(_Ty)(_X), _Y)); }
  238. _TMPLT(_Ty) inline
  239.     _CMPLX(_Ty) __cdecl pow(const _Ty& _X, const _CMPLX(_Ty)& _Y)
  240.     {if (imag(_Y) == 0)
  241.         return (_CMPLX(_Ty)(_CTR(_Ty)::pow(_X, real(_Y))));
  242.     else
  243.         return (exp(_Y * _CTR(_Ty)::log(_X))); }
  244.         // TEMPLATE FUNCTION sin
  245. _TMPLT(_Ty) inline
  246.     _CMPLX(_Ty) __cdecl sin(const _CMPLX(_Ty)& _X)
  247.     {return (_CMPLX(_Ty)(
  248.         _CTR(_Ty)::_Cosh(imag(_X), _CTR(_Ty)::sin(real(_X))),
  249.         _CTR(_Ty)::_Sinh(imag(_X), _CTR(_Ty)::cos(real(_X))))); }
  250.         // TEMPLATE FUNCTION sinh
  251. _TMPLT(_Ty) inline
  252.     _CMPLX(_Ty) __cdecl sinh(const _CMPLX(_Ty)& _X)
  253.     {return (_CMPLX(_Ty)(
  254.         _CTR(_Ty)::_Sinh(real(_X), _CTR(_Ty)::cos(imag(_X))),
  255.         _CTR(_Ty)::_Cosh(real(_X), _CTR(_Ty)::sin(imag(_X))))); }
  256.         // TEMPLATE FUNCTION sqrt
  257. _TMPLT(_Ty) inline
  258.     _CMPLX(_Ty) __cdecl sqrt(const _CMPLX(_Ty)& _X)
  259.     {int _Xexp;
  260.     _Ty _Rho = _Fabs(_X, &_Xexp);
  261.     if (_Xexp == 0)
  262.         return (_CMPLX(_Ty)(_Rho, _Rho));
  263.     else
  264.         {_Ty _Remag = _CTR(_Ty)::ldexp(real(_X) < 0
  265.             ? - real(_X) : real(_X), -_Xexp);
  266.         _Rho = _CTR(_Ty)::ldexp(_CTR(_Ty)::sqrt(
  267.             2 * (_Remag + _Rho)), _Xexp / 2 - 1);
  268.         if (0 <= real(_X))
  269.             return (_CMPLX(_Ty)(_Rho, imag(_X) / (2 * _Rho)));
  270.         else if (imag(_X) < 0)
  271.             return (_CMPLX(_Ty)(-imag(_X) / (2 * _Rho), -_Rho));
  272.         else
  273.             return (_CMPLX(_Ty)(imag(_X) / (2 * _Rho),
  274.                 _Rho)); }}
  275.  
  276. #ifdef _DLL
  277. #pragma warning(disable:4231) /* the extern before template is a non-standard extension */
  278.  
  279. extern template _CRTIMP complex<float>& __cdecl operator+=(
  280.         complex<float>&, const complex<float>&);
  281. extern template _CRTIMP complex<float>& __cdecl operator-=(
  282.         complex<float>&, const complex<float>&);
  283. extern template _CRTIMP complex<float>& __cdecl operator*=(
  284.         complex<float>&, const complex<float>&);
  285. extern template _CRTIMP complex<float>& __cdecl operator/=(
  286.         complex<float>&, const complex<float>&);
  287.  
  288. extern template _CRTIMP basic_istream<char, char_traits<char> >& __cdecl operator>>(
  289.         basic_istream<char, char_traits<char> >&, complex<float>&);
  290. extern template _CRTIMP basic_ostream<char, char_traits<char> >& __cdecl operator<<(
  291.         basic_ostream<char, char_traits<char> >&, const complex<float>&);
  292. extern template _CRTIMP basic_istream<wchar_t, char_traits<wchar_t> >& __cdecl operator>>(
  293.         basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
  294. extern template _CRTIMP basic_ostream<wchar_t, char_traits<wchar_t> >& __cdecl operator<<(
  295.         basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
  296.  
  297. extern template _CRTIMP complex<double>& __cdecl operator+=(
  298.         complex<double>&, const complex<double>&);
  299. extern template _CRTIMP complex<double>& __cdecl operator-=(
  300.         complex<double>&, const complex<double>&);
  301. extern template _CRTIMP complex<double>& __cdecl operator*=(
  302.         complex<double>&, const complex<double>&);
  303. extern template _CRTIMP complex<double>& __cdecl operator/=(
  304.         complex<double>&, const complex<double>&);
  305. extern template _CRTIMP basic_istream<char, char_traits<char> >& __cdecl operator>>(
  306.         basic_istream<char, char_traits<char> >&, complex<double>&);
  307. extern template _CRTIMP basic_ostream<char, char_traits<char> >& __cdecl operator<<(
  308.         basic_ostream<char, char_traits<char> >&, const complex<double>&);
  309. extern template _CRTIMP basic_istream<wchar_t, char_traits<wchar_t> >& __cdecl operator>>(
  310.         basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
  311. extern template _CRTIMP basic_ostream<wchar_t, char_traits<wchar_t> >& __cdecl operator<<(
  312.         basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
  313.  
  314. extern template _CRTIMP complex<long double>& __cdecl operator+=(
  315.         complex<long double>&, const complex<long double>&);
  316. extern template _CRTIMP complex<long double>& __cdecl operator-=(
  317.         complex<long double>&, const complex<long double>&);
  318. extern template _CRTIMP complex<long double>& __cdecl operator*=(
  319.         complex<long double>&, const complex<long double>&);
  320. extern template _CRTIMP complex<long double>& __cdecl operator/=(
  321.         complex<long double>&, const complex<long double>&);
  322. extern template _CRTIMP basic_istream<char, char_traits<char> >& __cdecl operator>>(
  323.         basic_istream<char, char_traits<char> >&, complex<long double>&);
  324. extern template _CRTIMP basic_ostream<char, char_traits<char> >& __cdecl operator<<(
  325.         basic_ostream<char, char_traits<char> >&, const complex<long double>&);
  326. extern template _CRTIMP basic_istream<wchar_t, char_traits<wchar_t> >& __cdecl operator>>(
  327.         basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
  328. extern template _CRTIMP basic_ostream<wchar_t, char_traits<wchar_t> >& __cdecl operator<<(
  329.         basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
  330.  
  331. extern template _CRTIMP float __cdecl imag(const complex<float>&);
  332. extern template _CRTIMP float __cdecl real(const complex<float>&);
  333. extern template _CRTIMP float __cdecl _Fabs(const complex<float>&, int *);
  334. extern template _CRTIMP complex<float> __cdecl operator+(
  335.         const complex<float>&, const complex<float>&);
  336. extern template _CRTIMP complex<float> __cdecl operator+(
  337.         const complex<float>&, const float&);
  338. extern template _CRTIMP complex<float> __cdecl operator+(
  339.         const float&, const complex<float>&);
  340. extern template _CRTIMP complex<float> __cdecl operator-(
  341.         const complex<float>&, const complex<float>&);
  342. extern template _CRTIMP complex<float> __cdecl operator-(
  343.         const complex<float>&, const float&);
  344. extern template _CRTIMP    complex<float> __cdecl operator-(
  345.         const float&, const complex<float>&);
  346. extern template _CRTIMP complex<float> __cdecl operator*(
  347.         const complex<float>&, const complex<float>&);
  348. extern template _CRTIMP complex<float> __cdecl operator*(
  349.         const complex<float>&, const float&);
  350. extern template _CRTIMP complex<float> __cdecl operator*(
  351.         const float&, const complex<float>&);
  352. extern template _CRTIMP complex<float> __cdecl operator/(
  353.         const complex<float>&, const complex<float>&);
  354. extern template _CRTIMP complex<float> __cdecl operator/(
  355.         const complex<float>&, const float&);
  356. extern template _CRTIMP complex<float> __cdecl operator/(
  357.         const float&, const complex<float>&);
  358. extern template _CRTIMP complex<float> __cdecl operator+(
  359.         const complex<float>&);
  360. extern template _CRTIMP complex<float> __cdecl operator-(
  361.         const complex<float>&);
  362. extern template _CRTIMP bool __cdecl operator==(
  363.         const complex<float>&, const complex<float>&);
  364. extern template _CRTIMP bool __cdecl operator==(
  365.         const complex<float>&, const float&);
  366. extern template _CRTIMP bool __cdecl operator==(
  367.         const float&, const complex<float>&);
  368. extern template _CRTIMP bool __cdecl operator!=(
  369.         const complex<float>&, const complex<float>&);
  370. extern template _CRTIMP bool __cdecl operator!=(
  371.         const complex<float>&, const float&);
  372. extern template _CRTIMP bool __cdecl operator!=(
  373.         const float&, const complex<float>&);
  374. extern template _CRTIMP float __cdecl abs(const complex<float>&);
  375. extern template _CRTIMP float __cdecl arg(const complex<float>&);
  376. extern template _CRTIMP complex<float> __cdecl conj(const complex<float>&);
  377. extern template _CRTIMP complex<float> __cdecl cos(const complex<float>&);
  378. extern template _CRTIMP complex<float> __cdecl cosh(const complex<float>&);
  379. extern template _CRTIMP complex<float> __cdecl exp(const complex<float>&);
  380. extern template _CRTIMP complex<float> __cdecl log(const complex<float>&);
  381. extern template _CRTIMP complex<float> __cdecl log10(const complex<float>&);
  382. extern template _CRTIMP float __cdecl norm(const complex<float>&);
  383. extern template _CRTIMP complex<float> __cdecl polar(const float&, const float&);
  384. extern template _CRTIMP complex<float> __cdecl polar(const float&);
  385. extern template _CRTIMP complex<float> __cdecl pow(
  386.         const complex<float>&, const complex<float>&);
  387. extern template _CRTIMP complex<float> __cdecl pow(
  388.         const complex<float>&, const float&);
  389. extern template _CRTIMP complex<float> __cdecl pow(
  390.         const complex<float>&, int);
  391. extern template _CRTIMP complex<float> __cdecl pow(
  392.         const float&, const complex<float>&);
  393. extern template _CRTIMP complex<float> __cdecl sin(const complex<float>&);
  394. extern template _CRTIMP complex<float> __cdecl sinh(const complex<float>&);
  395. extern template _CRTIMP complex<float> __cdecl sqrt(const complex<float>&);
  396.  
  397. extern template _CRTIMP double __cdecl imag(const complex<double>&);
  398. extern template _CRTIMP double __cdecl real(const complex<double>&);
  399. extern template _CRTIMP double __cdecl _Fabs(const complex<double>&, int *);
  400. extern template _CRTIMP complex<double> __cdecl operator+(
  401.         const complex<double>&, const complex<double>&);
  402. extern template _CRTIMP complex<double> __cdecl operator+(
  403.         const complex<double>&, const double&);
  404. extern template _CRTIMP complex<double> __cdecl operator+(
  405.         const double&, const complex<double>&);
  406. extern template _CRTIMP complex<double> __cdecl operator-(
  407.         const complex<double>&, const complex<double>&);
  408. extern template _CRTIMP complex<double> __cdecl operator-(
  409.         const complex<double>&, const double&);
  410. extern template _CRTIMP    complex<double> __cdecl operator-(
  411.         const double&, const complex<double>&);
  412. extern template _CRTIMP complex<double> __cdecl operator*(
  413.         const complex<double>&, const complex<double>&);
  414. extern template _CRTIMP complex<double> __cdecl operator*(
  415.         const complex<double>&, const double&);
  416. extern template _CRTIMP complex<double> __cdecl operator*(
  417.         const double&, const complex<double>&);
  418. extern template _CRTIMP complex<double> __cdecl operator/(
  419.         const complex<double>&, const complex<double>&);
  420. extern template _CRTIMP complex<double> __cdecl operator/(
  421.         const complex<double>&, const double&);
  422. extern template _CRTIMP complex<double> __cdecl operator/(
  423.         const double&, const complex<double>&);
  424. extern template _CRTIMP complex<double> __cdecl operator+(
  425.         const complex<double>&);
  426. extern template _CRTIMP complex<double> __cdecl operator-(
  427.         const complex<double>&);
  428. extern template _CRTIMP bool __cdecl operator==(
  429.         const complex<double>&, const complex<double>&);
  430. extern template _CRTIMP bool __cdecl operator==(
  431.         const complex<double>&, const double&);
  432. extern template _CRTIMP bool __cdecl operator==(
  433.         const double&, const complex<double>&);
  434. extern template _CRTIMP bool __cdecl operator!=(
  435.         const complex<double>&, const complex<double>&);
  436. extern template _CRTIMP bool __cdecl operator!=(
  437.         const complex<double>&, const double&);
  438. extern template _CRTIMP bool __cdecl operator!=(
  439.         const double&, const complex<double>&);
  440. extern template _CRTIMP double __cdecl abs(const complex<double>&);
  441. extern template _CRTIMP double __cdecl arg(const complex<double>&);
  442. extern template _CRTIMP complex<double> __cdecl conj(const complex<double>&);
  443. extern template _CRTIMP complex<double> __cdecl cos(const complex<double>&);
  444. extern template _CRTIMP complex<double> __cdecl cosh(const complex<double>&);
  445. extern template _CRTIMP complex<double> __cdecl exp(const complex<double>&);
  446. extern template _CRTIMP complex<double> __cdecl log(const complex<double>&);
  447. extern template _CRTIMP complex<double> __cdecl log10(const complex<double>&);
  448. extern template _CRTIMP double __cdecl norm(const complex<double>&);
  449. extern template _CRTIMP complex<double> __cdecl polar(const double&, const double&);
  450. extern template _CRTIMP complex<double> __cdecl polar(const double&);
  451. extern template _CRTIMP complex<double> __cdecl pow(
  452.         const complex<double>&, const complex<double>&);
  453. extern template _CRTIMP complex<double> __cdecl pow(
  454.         const complex<double>&, const double&);
  455. extern template _CRTIMP complex<double> __cdecl pow(
  456.         const complex<double>&, int);
  457. extern template _CRTIMP complex<double> __cdecl pow(
  458.         const double&, const complex<double>&);
  459. extern template _CRTIMP complex<double> __cdecl sin(const complex<double>&);
  460. extern template _CRTIMP complex<double> __cdecl sinh(const complex<double>&);
  461. extern template _CRTIMP complex<double> __cdecl sqrt(const complex<double>&);
  462.  
  463. extern template _CRTIMP long double __cdecl imag(const complex<long double>&);
  464. extern template _CRTIMP long double __cdecl real(const complex<long double>&);
  465. extern template _CRTIMP long double __cdecl _Fabs(const complex<long double>&, int *);
  466. extern template _CRTIMP complex<long double> __cdecl operator+(
  467.         const complex<long double>&, const complex<long double>&);
  468. extern template _CRTIMP complex<long double> __cdecl operator+(
  469.         const complex<long double>&, const long double&);
  470. extern template _CRTIMP complex<long double> __cdecl operator+(
  471.         const long double&, const complex<long double>&);
  472. extern template _CRTIMP complex<long double> __cdecl operator-(
  473.         const complex<long double>&, const complex<long double>&);
  474. extern template _CRTIMP complex<long double> __cdecl operator-(
  475.         const complex<long double>&, const long double&);
  476. extern template _CRTIMP    complex<long double> __cdecl operator-(
  477.         const long double&, const complex<long double>&);
  478. extern template _CRTIMP complex<long double> __cdecl operator*(
  479.         const complex<long double>&, const complex<long double>&);
  480. extern template _CRTIMP complex<long double> __cdecl operator*(
  481.         const complex<long double>&, const long double&);
  482. extern template _CRTIMP complex<long double> __cdecl operator*(
  483.         const long double&, const complex<long double>&);
  484. extern template _CRTIMP complex<long double> __cdecl operator/(
  485.         const complex<long double>&, const complex<long double>&);
  486. extern template _CRTIMP complex<long double> __cdecl operator/(
  487.         const complex<long double>&, const long double&);
  488. extern template _CRTIMP complex<long double> __cdecl operator/(
  489.         const long double&, const complex<long double>&);
  490. extern template _CRTIMP complex<long double> __cdecl operator+(
  491.         const complex<long double>&);
  492. extern template _CRTIMP complex<long double> __cdecl operator-(
  493.         const complex<long double>&);
  494. extern template _CRTIMP bool __cdecl operator==(
  495.         const complex<long double>&, const complex<long double>&);
  496. extern template _CRTIMP bool __cdecl operator==(
  497.         const complex<long double>&, const long double&);
  498. extern template _CRTIMP bool __cdecl operator==(
  499.         const long double&, const complex<long double>&);
  500. extern template _CRTIMP bool __cdecl operator!=(
  501.         const complex<long double>&, const complex<long double>&);
  502. extern template _CRTIMP bool __cdecl operator!=(
  503.         const complex<long double>&, const long double&);
  504. extern template _CRTIMP bool __cdecl operator!=(
  505.         const long double&, const complex<long double>&);
  506. extern template _CRTIMP long double __cdecl abs(const complex<long double>&);
  507. extern template _CRTIMP long double __cdecl arg(const complex<long double>&);
  508. extern template _CRTIMP complex<long double> __cdecl conj(const complex<long double>&);
  509. extern template _CRTIMP complex<long double> __cdecl cos(const complex<long double>&);
  510. extern template _CRTIMP complex<long double> __cdecl cosh(const complex<long double>&);
  511. extern template _CRTIMP complex<long double> __cdecl exp(const complex<long double>&);
  512. extern template _CRTIMP complex<long double> __cdecl log(const complex<long double>&);
  513. extern template _CRTIMP complex<long double> __cdecl log10(const complex<long double>&);
  514. extern template _CRTIMP long double __cdecl norm(const complex<long double>&);
  515. extern template _CRTIMP complex<long double> __cdecl polar(const long double&, const long double&);
  516. extern template _CRTIMP complex<long double> __cdecl polar(const long double&);
  517. extern template _CRTIMP complex<long double> __cdecl pow(
  518.         const complex<long double>&, const complex<long double>&);
  519. extern template _CRTIMP complex<long double> __cdecl pow(
  520.         const complex<long double>&, const long double&);
  521. extern template _CRTIMP complex<long double> __cdecl pow(
  522.         const complex<long double>&, int);
  523. extern template _CRTIMP complex<long double> __cdecl pow(
  524.         const long double&, const complex<long double>&);
  525. extern template _CRTIMP complex<long double> __cdecl sin(const complex<long double>&);
  526. extern template _CRTIMP complex<long double> __cdecl sinh(const complex<long double>&);
  527. extern template _CRTIMP complex<long double> __cdecl sqrt(const complex<long double>&);
  528.  
  529. #pragma warning(default:4231) /* restore previous warning */
  530. #endif        // _DLL
  531.  
  532. #endif          /* _XCOMPLEX */
  533.  
  534. /*
  535.  * Copyright (c) 1996 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  536.  * Consult your license regarding permissions and restrictions.
  537.  */
  538.