Subject: [Boost-bugs] [Boost C++ Libraries] #12191: Unable to produce proper multiprecision output from sph_neumann() function
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-05-11 22:24:32
#12191: Unable to produce proper multiprecision output from sph_neumann() function
---------------------------+------------------------------
Reporter: James_Booth@⦠| Type: Bugs
Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.61.0
Severity: Problem | Keywords:
---------------------------+------------------------------
I am trying to use the boost c++ libraries to compute a multiprecision
value for the spherical bessel functions and spherical neumann functions.
To test the boost package I am using the relationships:
pi/6*Spherical_Bessel(0,pi/6) = sin(pi/6) = 0.5
-pi/6*Spherical_Neumann(0,pi/6) = cos(pi/6) = sqrt(3)/2 = 0.866....
My test code is:
#include <boost/multiprecision/mpfr.hpp>
#include <boost/math/special_functions/bessel.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/multiprecision/number.hpp>
#define PRECISION 40 // Can be set to any number desired.
using namespace std;
using namespace boost::multiprecision;
using namespace boost;
mpfr_float::default_precision(PRECISION);
mpfr_float z, my_pi;
my_pi =
boost::multiprecision::atan(mpfr_float("1.0"))*mpfr_float("4.0"); //
Define pi as a multiprecision value to precision = PRECISION.
z = my_pi/mpfr_float("6.0");
cout << z*mpfr_float(boost::math::sph_bessel(0,z)) << endl;
cout << mpfr_float("-1.0")*z*mpfr_float(boost::math::sph_neumann(0,z))
<< endl;
========================================================================
The value of my_pi agrees with the value computed by Wolfram (to at
least 100 decimal places).
The value of z also agrees with the value from Wolfram.
The output for the z*sph_bessel(0,z) function is correct:
0.5000000000....
The output for the -z*sph_neumann(0,z) function is incorrect:
0.86602540378443864***30***... instead of 0.86602540378443864***67***....
Which looks like the answer is not multiprecision but a float.
Can you please help with this bug?
Thanks.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12191> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC