[R] Difference between R for the Mac and for Windows

Berend Hasselman bhh at xs4all.nl
Fri Mar 31 19:37:24 CEST 2017


> On 31 Mar 2017, at 19:28, John McKown <john.archie.mckown at gmail.com> wrote:
> 
> On Fri, Mar 31, 2017 at 12:15 PM, Berend Hasselman <bhh at xs4all.nl> wrote:
> 
> I have noted a difference between R on macOS en on Kubuntu Trusty (64bits) with complex division.
> I don't know what would happen R on Windows.
> 
> R.3.3.3:
> 
> macOS (10.11.6)
> -----------------
> > (1+2i)/0
> [1] NaN+NaNi
> > (-1+2i)/0
> [1] NaN+NaNi
> >
> > 1i/0
> [1] NaN+NaNi
> > 1i/(0+0i)
> [1] NaN+NaNi
> 
> 
> KubuntuTrusty
> -----------------
> > (1+2i)/0
> [1] Inf+Infi
> > (-1+2i)/0
> [1] -Inf+Infi
> >
> > 1i/0
> [1] NaN+Infi
> > 1i/(0+0i)
> [1] NaN+Infi
> 
> Interesting to see what R on Windows delivers.
> 
> ​> (1+2i)/0
> [1] Inf+Infi
> > (-1+2i)/0
> [1] -Inf+Infi
> > 1i/0
> [1] NaN+Infi
> > 1i/(0+0i)
> [1] NaN+Infi
> > Sys.info()
>                      sysname                      release 
>                    "Windows"                      "7 x64" 
>                      version                     nodename 
> "build 7601, Service Pack 1"                 "IT-JMCKOWN" 
>                      machine                        login 
>                     "x86-64"                "John.Mckown" 
>                         user               effective_user 
>                "John.Mckown"                "John.Mckown" 
> > 
> 
> Same as Kubuntu. I am _guessing_ that the MacOS somehow sets up the floating point processing to work differently, since they are all on Intel machines nowadays. Or the R was customized to detect division by zero in software and not really do any floating point processing at all.
>> 

I think it's the system math library that does this.

I have assumed that the Kubuntu Trusty (and Windows) give the correct result.
In my package geigen I have taken that into account and made a specialized complexdivision function that tries to detect a possibly wrong outcome (which appears to happen only on macOS).

Berend Hasselman

> Berend Hasselman
> 
> 
> 
> -- 
> "Irrigation of the land with seawater desalinated by fusion power is ancient. It's called 'rain'." -- Michael McClary, in alt.fusion
> 
> Maranatha! <><
> John McKown



More information about the R-help mailing list