mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Fix asinh and acosh to work with very large arguments without overflow.
[SVN r80884]
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/log1p.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
// This is the inverse of the hyperbolic cosine function.
|
||||
|
||||
@@ -58,7 +59,7 @@ namespace boost
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcCosh/06/01/06/01/0001/
|
||||
// approximation by laurent series in 1/x at 0+ order from -1 to 0
|
||||
return( log( x * 2) );
|
||||
return log(x) + constants::ln_two<T>();
|
||||
}
|
||||
else if(x < 1.5f)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/sqrt1pm1.hpp>
|
||||
#include <boost/math/special_functions/log1p.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
// This is the inverse of the hyperbolic sine function.
|
||||
|
||||
@@ -52,7 +53,7 @@ namespace boost
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcSinh/06/01/06/01/0001/
|
||||
// approximation by laurent series in 1/x at 0+ order from -1 to 1
|
||||
return log(x * 2) + 1/ (4 * x * x);
|
||||
return constants::ln_two<T>() + log(x) + 1/ (4 * x * x);
|
||||
}
|
||||
else if(x < 0.5f)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user