diff options
author | dim <dim@FreeBSD.org> | 2012-10-22 18:25:04 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-10-22 18:25:04 +0000 |
commit | 708d8e446e991358da23bb52ec5320440221f12f (patch) | |
tree | 3a061d75674cd5b60d9f6df45d0b8d755da3782f /contrib/libc++/include/complex | |
parent | b8c74d455d2690e710a0802a98a9d310995a52eb (diff) | |
parent | 13334223d751d249ccd6475b8cba36ff71ddc972 (diff) | |
download | FreeBSD-src-708d8e446e991358da23bb52ec5320440221f12f.zip FreeBSD-src-708d8e446e991358da23bb52ec5320440221f12f.tar.gz |
Import libc++ trunk r165949. Among other improvements and bug fixes,
this has many visibility problems fixed, which should help with
compiling certain ports that exercise C++11 mode (i.e. Firefox).
Also, belatedly add the LICENSE.TXT and accompanying CREDITS.TXT files,
which are referred to in all the source files.
MFC after: 1 month
Diffstat (limited to 'contrib/libc++/include/complex')
-rw-r--r-- | contrib/libc++/include/complex | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/contrib/libc++/include/complex b/contrib/libc++/include/complex index 3b660a3..6f88152 100644 --- a/contrib/libc++/include/complex +++ b/contrib/libc++/include/complex @@ -330,13 +330,13 @@ class _LIBCPP_VISIBLE complex<float> public: typedef float value_type; - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re), __im_(__im) {} - explicit /*constexpr*/ complex(const complex<double>& __c); - explicit /*constexpr*/ complex(const complex<long double>& __c); + explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c); + explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;} - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} @@ -386,13 +386,13 @@ class _LIBCPP_VISIBLE complex<double> public: typedef double value_type; - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) : __re_(__re), __im_(__im) {} - /*constexpr*/ complex(const complex<float>& __c); - explicit /*constexpr*/ complex(const complex<long double>& __c); + _LIBCPP_CONSTEXPR complex(const complex<float>& __c); + explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;} - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} @@ -442,13 +442,13 @@ class _LIBCPP_VISIBLE complex<long double> public: typedef long double value_type; - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L) : __re_(__re), __im_(__im) {} - /*constexpr*/ complex(const complex<float>& __c); - /*constexpr*/ complex(const complex<double>& __c); + _LIBCPP_CONSTEXPR complex(const complex<float>& __c); + _LIBCPP_CONSTEXPR complex(const complex<double>& __c); - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;} - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} @@ -490,33 +490,33 @@ public: } }; -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex<float>::complex(const complex<double>& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex<float>::complex(const complex<long double>& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex<double>::complex(const complex<float>& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex<double>::complex(const complex<long double>& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex<long double>::complex(const complex<float>& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex<long double>::complex(const complex<double>& __c) : __re_(__c.real()), __im_(__c.imag()) {} @@ -1351,7 +1351,11 @@ tanh(const complex<_Tp>& __x) _Tp __2r(_Tp(2) * __x.real()); _Tp __2i(_Tp(2) * __x.imag()); _Tp __d(cosh(__2r) + cos(__2i)); - return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d); + _Tp __2rsh(sinh(__2r)); + if (isinf(__2rsh) && isinf(__d)) + return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), + __2i > _Tp(0) ? _Tp(0) : _Tp(-0.)); + return complex<_Tp>(__2rsh/__d, sin(__2i)/__d); } // asin |