Lines Matching +full:real +full:-

1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
29 T real() const; // constexpr in C++14
32 void real(T); // constexpr in C++20
37 complex<T>& operator-=(const T&); // constexpr in C++20
44 template<class X> complex<T>& operator-=(const complex<X>&); // constexpr in C++20
59 constexpr float real() const;
60 void real(float); // constexpr in C++20
66 complex<float>& operator-=(float); // constexpr in C++20
73 template<class X> complex<float>& operator-=(const complex<X>&); // constexpr in C++20
88 constexpr double real() const;
89 void real(double); // constexpr in C++20
95 complex<double>& operator-=(double); // constexpr in C++20
102 template<class X> complex<double>& operator-=(const complex<X>&); // constexpr in C++20
117 constexpr long double real() const;
118 void real(long double); // constexpr in C++20
125 complex<long double>& operator-=(long double); // constexpr in C++20
131 template<class X> complex<long double>& operator-=(const complex<X>&); // constexpr in C++20
140 template<class T> complex<T> operator-(const complex<T>&, const complex<T>&); // constexpr in C++20
141 template<class T> complex<T> operator-(const complex<T>&, const T&); // constexpr in C++20
142 template<class T> complex<T> operator-(const T&, const complex<T>&); // constexpr in C++20
150 template<class T> complex<T> operator-(const complex<T>&); // constexpr in C++20
167 template<class T> T real(const complex<T>&); // constexpr in C++14
168 long double real(long double); // constexpr in C++14
169 double real(double); // constexpr in C++14
170 template<Integral T> double real(T); // constexpr in C++14
171 float real(float); // constexpr in C++14
316 : __re_(__c.real()), __im_(__c.imag()) {}
318 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 value_type real() const { return __re_; }
321 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
333 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const value_type& __re) {
334 __re_ -= __re;
350 __re_ = __c.real();
356 __re_ += __c.real();
361 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
362 __re_ -= __c.real();
363 __im_ -= __c.imag();
368 *this = *this * complex(__c.real(), __c.imag());
373 *this = *this / complex(__c.real(), __c.imag());
431 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float real() const { return __re_; }
434 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
452 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(float __re) {
453 __re_ -= __re;
469 __re_ = __c.real();
475 __re_ += __c.real();
480 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
481 __re_ -= __c.real();
482 __im_ -= __c.imag();
487 *this = *this * complex(__c.real(), __c.imag());
492 *this = *this / complex(__c.real(), __c.imag());
528 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double real() const { return __re_; }
531 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
552 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(double __re) {
553 __re_ -= __re;
569 __re_ = __c.real();
575 __re_ += __c.real();
580 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
581 __re_ -= __c.real();
582 __im_ -= __c.imag();
587 *this = *this * complex(__c.real(), __c.imag());
592 *this = *this / complex(__c.real(), __c.imag());
629 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double real() const { return __re_; }
632 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void real(value_type __re) { __re_ = __re; }
653 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(long double __re) {
654 __re_ -= __re;
670 __re_ = __c.real();
676 __re_ += __c.real();
681 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex& operator-=(const complex<_Xp>& __c) {
682 __re_ -= __c.real();
683 __im_ -= __c.imag();
688 *this = *this * complex(__c.real(), __c.imag());
693 *this = *this / complex(__c.real(), __c.imag());
712 inline _LIBCPP_CONSTEXPR complex<float>::complex(const complex<double>& __c) : __re_(__c.real()), _…
715 : __re_(__c.real()), __im_(__c.imag()) {}
717 inline _LIBCPP_CONSTEXPR complex<double>::complex(const complex<float>& __c) : __re_(__c.real()), _…
720 : __re_(__c.real()), __im_(__c.imag()) {}
723 : __re_(__c.real()), __im_(__c.imag()) {}
726 : __re_(__c.real()), __im_(__c.imag()) {}
756 operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) {
758 __t -= __y;
764 operator-(const complex<_Tp>& __x, const _Tp& __y) {
766 __t -= __y;
772 operator-(const _Tp& __x, const complex<_Tp>& __y) {
773 complex<_Tp> __t(-__y);
787 _Tp __a = __z.real();
789 _Tp __c = __w.real();
792 return complex<_Tp>((__a * __c) - (__b * __d), (__a * __d) + (__b * __c));
820 _Tp __a = __z.real();
822 _Tp __c = __w.real();
826 return complex<_Tp>((__a * __c + __b * __d) / __denom, (__b * __c - __a * __d) / __denom);
832 return complex<_Tp>(__x.real() / __y, __x.imag() / __y);
849 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 complex<_Tp> operator-(const complex<_Tp…
850 return complex<_Tp>(-__x.real(), -__x.imag());
856 return __x.real() == __y.real() && __x.imag() == __y.imag();
861 return __x.real() == __y && __x.imag() == 0;
868 return __x == __y.real() && 0 == __y.imag();
908 // real
911 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp real(const complex<_Tp>& __c) {
912 return __c.real();
917 real(_Tp __re) {
938 return std::hypot(__c.real(), __c.imag());
945 return std::atan2(__c.imag(), __c.real());
967 if (std::__constexpr_isinf(__c.real()))
968 return std::abs(__c.real());
971 return __c.real() * __c.real() + __c.imag() * __c.imag();
985 return complex<_Tp>(__c.real(), -__c.imag());
1000 if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag()))
1063 if (std::__constexpr_isinf(__x.real())) {
1064 if (__x.real() > _Tp(0))
1066 … __x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag()));
1068 … std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag()));
1079 return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
1081 if (std::__constexpr_isinf(__x.real())) {
1082 if (__x.real() < _Tp(0)) {
1088 return complex<_Tp>(__x.real(), __i);
1091 _Tp __e = std::exp(__x.real());
1125 …return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), _Tp(2) * __x.real() * _…
1132 const _Tp __pi(atan2(+0., -0.));
1133 if (std::__constexpr_isinf(__x.real())) {
1137 return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
1138 return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
1140 if (std::__constexpr_isnan(__x.real())) {
1142 return complex<_Tp>(__x.imag(), __x.real());
1145 return complex<_Tp>(__x.real(), __x.real());
1148 …return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()…
1150 return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
1157 const _Tp __pi(atan2(+0., -0.));
1158 if (std::__constexpr_isinf(__x.real())) {
1160 return complex<_Tp>(std::abs(__x.real()), __x.imag());
1162 if (__x.real() > 0)
1163 return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
1165 return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag()));
1167 if (__x.real() < 0)
1168 return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag()));
1169 return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
1171 if (std::__constexpr_isnan(__x.real())) {
1173 return complex<_Tp>(std::abs(__x.imag()), __x.real());
1174 return complex<_Tp>(__x.real(), __x.real());
1178 complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
1179 return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag()));
1186 const _Tp __pi(atan2(+0., -0.));
1188 … return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
1191 if (std::__constexpr_isinf(__x.real()) || __x.real() == 0)
1192 return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag());
1195 if (std::__constexpr_isnan(__x.real())) {
1196 return complex<_Tp>(__x.real(), __x.real());
1198 if (std::__constexpr_isinf(__x.real())) {
1199 … return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag()));
1201 if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
1202 … return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag()));
1204 complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
1205 return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
1212 if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
1213 return complex<_Tp>(__x.real(), _Tp(NAN));
1214 if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
1215 return complex<_Tp>(__x.real(), _Tp(NAN));
1216 if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
1218 …return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin…
1225 if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
1226 return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
1227 if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
1228 return complex<_Tp>(_Tp(NAN), __x.real());
1229 if (__x.real() == 0 && __x.imag() == 0)
1231 if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
1232 return complex<_Tp>(std::abs(__x.real()), __x.imag());
1233 …return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin…
1240 if (std::__constexpr_isinf(__x.real())) {
1242 return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
1243 …return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x…
1245 if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0)
1247 _Tp __2r(_Tp(2) * __x.real());
1252 return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
1260 complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
1261 return complex<_Tp>(__z.imag(), -__z.real());
1268 const _Tp __pi(atan2(+0., -0.));
1269 if (std::__constexpr_isinf(__x.real())) {
1271 return complex<_Tp>(__x.imag(), __x.real());
1273 if (__x.real() < _Tp(0))
1274 return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
1275 return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
1277 if (__x.real() < _Tp(0))
1278 return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real());
1279 return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real());
1281 if (std::__constexpr_isnan(__x.real())) {
1283 return complex<_Tp>(__x.real(), -__x.imag());
1284 return complex<_Tp>(__x.real(), __x.real());
1287 return complex<_Tp>(__pi / _Tp(2), -__x.imag());
1288 if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag())))
1289 return complex<_Tp>(__pi / _Tp(2), -__x.imag());
1290 complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
1292 return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real()));
1293 return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real()));
1300 complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
1301 return complex<_Tp>(__z.imag(), -__z.real());
1308 complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
1309 return complex<_Tp>(__z.imag(), -__z.real());
1316 return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
1323 complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
1324 return complex<_Tp>(__z.imag(), -__z.real());
1381 __s << '(' << __x.real() << ',' << __x.imag() << ')';