Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // boost asinh.hpp header file
3 // (C) Copyright Eric Ford & Hubert Holin 2001.
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org for updates, documentation, and revision history.
10 #ifndef BOOST_ASINH_HPP
11 #define BOOST_ASINH_HPP
20 #include <boost/config.hpp>
23 // This is the inverse of the hyperbolic sine function.
29 #if defined(__GNUC__) && (__GNUC__ < 3)
30 // gcc 2.x ignores function scope using declarations,
31 // put them in the scope of the enclosing namespace instead:
37 using ::std::numeric_limits;
41 inline T asinh(const T x)
47 using ::std::numeric_limits;
50 T const one = static_cast<T>(1);
51 T const two = static_cast<T>(2);
53 static T const taylor_2_bound = sqrt(numeric_limits<T>::epsilon());
54 static T const taylor_n_bound = sqrt(taylor_2_bound);
55 static T const upper_taylor_2_bound = one/taylor_2_bound;
56 static T const upper_taylor_n_bound = one/taylor_n_bound;
58 if (x >= +taylor_n_bound)
60 if (x > upper_taylor_n_bound)
62 if (x > upper_taylor_2_bound)
64 // approximation by laurent series in 1/x at 0+ order from -1 to 0
65 return( log( x * two) );
69 // approximation by laurent series in 1/x at 0+ order from -1 to 1
70 return( log( x*two + (one/(x*two)) ) );
75 return( log( x + sqrt(x*x+one) ) );
78 else if (x <= -taylor_n_bound)
84 // approximation by taylor series in x at 0 up to order 2
87 if (abs(x) >= taylor_2_bound)
91 // approximation by taylor series in x at 0 up to order 4
92 result -= x3/static_cast<T>(6);
101 #endif /* BOOST_ASINH_HPP */