|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80884 - trunk/boost/math/special_functions
From: john_at_[hidden]
Date: 2012-10-06 12:53:16
Author: johnmaddock
Date: 2012-10-06 12:53:15 EDT (Sat, 06 Oct 2012)
New Revision: 80884
URL: http://svn.boost.org/trac/boost/changeset/80884
Log:
Fix asinh and acosh to work with very large arguments without overflow.
Text files modified:
trunk/boost/math/special_functions/acosh.hpp | 3 ++-
trunk/boost/math/special_functions/asinh.hpp | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
Modified: trunk/boost/math/special_functions/acosh.hpp
==============================================================================
--- trunk/boost/math/special_functions/acosh.hpp (original)
+++ trunk/boost/math/special_functions/acosh.hpp 2012-10-06 12:53:15 EDT (Sat, 06 Oct 2012)
@@ -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 @@
{
// 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)
{
Modified: trunk/boost/math/special_functions/asinh.hpp
==============================================================================
--- trunk/boost/math/special_functions/asinh.hpp (original)
+++ trunk/boost/math/special_functions/asinh.hpp 2012-10-06 12:53:15 EDT (Sat, 06 Oct 2012)
@@ -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 @@
{
// 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)
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk