id summary reporter owner description type status milestone component version severity resolution keywords cc 9748 cyl_bessel_j returns incorrect sign when using --fast-math on GCC or -std=c++11 on Intel Compiler Dustin Lanham John Maddock "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 #include 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." Bugs closed To Be Determined math Boost 1.55.0 Problem fixed