sl@0
|
1 |
// (C) Copyright John Maddock 2005.
|
sl@0
|
2 |
// Use, modification and distribution are subject to the
|
sl@0
|
3 |
// Boost Software License, Version 1.0. (See accompanying file
|
sl@0
|
4 |
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
5 |
|
sl@0
|
6 |
#ifndef BOOST_MATH_COMPLEX_ACOSH_INCLUDED
|
sl@0
|
7 |
#define BOOST_MATH_COMPLEX_ACOSH_INCLUDED
|
sl@0
|
8 |
|
sl@0
|
9 |
#ifndef BOOST_MATH_COMPLEX_DETAILS_INCLUDED
|
sl@0
|
10 |
# include <boost/math/complex/details.hpp>
|
sl@0
|
11 |
#endif
|
sl@0
|
12 |
#ifndef BOOST_MATH_COMPLEX_ATANH_INCLUDED
|
sl@0
|
13 |
# include <boost/math/complex/acos.hpp>
|
sl@0
|
14 |
#endif
|
sl@0
|
15 |
|
sl@0
|
16 |
namespace boost{ namespace math{
|
sl@0
|
17 |
|
sl@0
|
18 |
template<class T>
|
sl@0
|
19 |
inline std::complex<T> acosh(const std::complex<T>& z)
|
sl@0
|
20 |
{
|
sl@0
|
21 |
//
|
sl@0
|
22 |
// We use the relation acosh(z) = +-i acos(z)
|
sl@0
|
23 |
// Choosing the sign of multiplier to give real(acosh(z)) >= 0
|
sl@0
|
24 |
// as well as compatibility with C99.
|
sl@0
|
25 |
//
|
sl@0
|
26 |
std::complex<T> result = boost::math::acos(z);
|
sl@0
|
27 |
if(!detail::test_is_nan(result.imag()) && result.imag() <= 0)
|
sl@0
|
28 |
return detail::mult_i(result);
|
sl@0
|
29 |
return detail::mult_minus_i(result);
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
} } // namespaces
|
sl@0
|
33 |
|
sl@0
|
34 |
#endif // BOOST_MATH_COMPLEX_ACOSH_INCLUDED
|