Subject: [Boost-bugs] [Boost C++ Libraries] #9748: cyl_bessel_j returns incorrect sign when using --fast-math on GCC or -std=c++11 on Intel Compiler
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-06 17:05:25
#9748: cyl_bessel_j returns incorrect sign when using --fast-math on GCC or
-std=c++11 on Intel Compiler
---------------------------------------+------------------------------
Reporter: Dustin Lanham <lanhamd@â¦> | Type: Bugs
Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.55.0
Severity: Problem | Keywords:
---------------------------------------+------------------------------
The cyl_bessel_j function returns the incorrect sign for certain inputs
when using GCC's --fast-math flag, or the Intel compiler's -std=c++11.
This bug has been shown to affect GCC 4.4.7 as delivered in RHEL 6.3 and
the Intel compiler version 13.1.3 20130607 on the same OS.
The following minimal case program can replicate the problem:
{{{
#include <boost/math/special_functions/bessel.hpp>
#include <iostream>
int main(int argc, char** argv)
{
double besselTerm = boost::math::cyl_bessel_j(1.5, 7.90559);
std::cout << besselTerm << std::endl;
}
}}}
When this program is compiled under GCC with the --fast-math flag, or ICPC
with the -std=c++11 flag, it gives a result of -0.0504874. Checking this
answer against a reference MATLAB implementation, or GCC 4.1.2 shows that
the correct answer should be 0.0504874. When compiled on GCC 4.4.7
*without* the --fast-math flag, or ICPC without the -std=c++11 flag, the
correct answer is returned.
This behavior has been found for all inputs of P from 1.5 to 30.5 with the
same Z input of 7.90559. Other values of Z can cause the problem as well,
but have not been included here for brevity. Note that not all
combinations of P and Z give invalid results, just some do, and the
behavior is always that the sign is wrong (the absolute value is correct).
Using the --fast-math flag on older versions of GCC produces the correct
result.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9748> 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:15 UTC