Somebody has reported unexpected results of tanh() on the r-devel mailing list:

  https://stat.ethz.ch/pipermail/r-devel/2017-March/073914.html

I was able to reproduce the problem on msys2 with gcc 6.3:

  #include <iostream>
  #include <cmath>
  #include <complex>

  int main(){
    std::cout << std::fixed;
    std::complex<double> z(356, 0);
    std::cout << "tanh" << z << " = " << std::tanh(z)
         << " (tanh(356) = " << std::tanh(356) << ")\n";
  }

On Linux / OS-X we get:

  tanh(356.000000,0.000000) = (1.000000,-0.000000) (tanh(356) = 1.000000)

But on Windows we get:

  tanh(356.000000,0.000000) = (nan,0.000000) (tanh(356) = 1.000000)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to