From rdonnelly at continuum.io  Fri Apr  7 11:53:08 2017
From: rdonnelly at continuum.io (Ray Donnelly)
Date: Fri, 7 Apr 2017 10:53:08 +0100
Subject: [Rd] Hyperbolic tangent different results on Windows and Mac
In-Reply-To: <CABFfbXvudeA1Gb8LCD+a=3QNTtTDQr=038TyTxbwN7Zzo5PRog@mail.gmail.com>
References: <CACtWsWMW8VJdzC8ZSG0a+3dGP29kVESOFFwOO3hMRpAuUQxnAw@mail.gmail.com>
 <CABFfbXu4hWq7JT14u2PYG-b6LCA7btPg2o=iOD2tgUaK48F9ew@mail.gmail.com>
 <CABFfbXvudeA1Gb8LCD+a=3QNTtTDQr=038TyTxbwN7Zzo5PRog@mail.gmail.com>
Message-ID: <CAF5kcVX9gk3dsSTKZMFSAAzLB7pNhUOqSwjTpu5Mj0H8sV5TJg@mail.gmail.com>

On Mon, Mar 27, 2017 at 12:33 PM, Jeroen Ooms <jeroenooms at gmail.com> wrote:

> For future reference:
> https://sourceforge.net/p/mingw-w64/mailman/message/35747206/
>
> On Wed, Mar 22, 2017 at 2:12 PM, Jeroen Ooms <jeroenooms at gmail.com> wrote:
> > This looks like a bug in mingw-w64 CRT. The problem can be produced
> > with C++ without R:
> >
> >   #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 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)
> >
> > I was also able to reproduce the problem with gcc 6.3 in msys2 so it
> > has not been fixed upstream. You should file a bug report for
> > mingw-w64.
> >
> > FWIF, we have run into NaN edge-case bugs before with mingw-w64.
> >
> >  - https://sourceforge.net/p/mingw-w64/mingw-w64/ci/
> 6617ebd5fc6b790c80071d5b1d950e737fc670e1/
> >  - https://github.com/wch/r-source/commit/e9aaf8fdeddf27c2a9078cd214a414
> 75c8ff6f40
> >
> > I am cc'ing Ray Donnelly who is an expert on mingw-w64.
>

Thanks for reporting this Jeroen. Hopefully Doug will take a look sometime
soon.

	[[alternative HTML version deleted]]



[Rd] Hyperbolic tangent different results on Windows and Mac
Ray Donnelly