]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/math/complex/details.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / math / complex / details.hpp
CommitLineData
7c673cae
FG
1// (C) Copyright John Maddock 2005.
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef BOOST_MATH_COMPLEX_DETAILS_INCLUDED
7#define BOOST_MATH_COMPLEX_DETAILS_INCLUDED
8//
9// This header contains all the support code that is common to the
10// inverse trig complex functions, it also contains all the includes
11// that we need to implement all these functions.
12//
1e59de90
TL
13
14#include <cmath>
15#include <complex>
16#include <limits>
7c673cae
FG
17#include <boost/math/special_functions/sign.hpp>
18#include <boost/math/special_functions/fpclassify.hpp>
19#include <boost/math/special_functions/sign.hpp>
20#include <boost/math/constants/constants.hpp>
21
7c673cae
FG
22namespace boost{ namespace math{ namespace detail{
23
24template <class T>
25inline T mult_minus_one(const T& t)
26{
27 return (boost::math::isnan)(t) ? t : (boost::math::changesign)(t);
28}
29
30template <class T>
31inline std::complex<T> mult_i(const std::complex<T>& t)
32{
33 return std::complex<T>(mult_minus_one(t.imag()), t.real());
34}
35
36template <class T>
37inline std::complex<T> mult_minus_i(const std::complex<T>& t)
38{
39 return std::complex<T>(t.imag(), mult_minus_one(t.real()));
40}
41
42template <class T>
43inline T safe_max(T t)
44{
45 return std::sqrt((std::numeric_limits<T>::max)()) / t;
46}
47inline long double safe_max(long double t)
48{
49 // long double sqrt often returns infinity due to
50 // insufficient internal precision:
51 return std::sqrt((std::numeric_limits<double>::max)()) / t;
52}
1e59de90 53
7c673cae
FG
54template <class T>
55inline T safe_min(T t)
56{
57 return std::sqrt((std::numeric_limits<T>::min)()) * t;
58}
59inline long double safe_min(long double t)
60{
61 // long double sqrt often returns zero due to
62 // insufficient internal precision:
63 return std::sqrt((std::numeric_limits<double>::min)()) * t;
64}
7c673cae
FG
65
66} } } // namespaces
67
68#endif // BOOST_MATH_COMPLEX_DETAILS_INCLUDED
69