That was a mistake on my part, the shout-across-the-office communication between him and me caused a misunderstanding. Everything is according to the details in ?round, both on our mac and linux laptops :)
On Fri, Apr 11, 2014 at 3:42 PM, Duncan Murdoch <[email protected]>wrote: > On 11/04/2014, 5:04 AM, peter dalgaard wrote: > >> Google for "round to even", and read the Details section of ?round. >> > > The behaviour on the Linux laptop does sound problematic, if it is really > giving round(4.5) = 5. We do have the warning there that it depends on OS > services, but this could cause other problems. > > Duncan Murdoch > > > > >> >> On 11 Apr 2014, at 10:42 , Per Nielsen <[email protected]> wrote: >> >> Hi all >>> >>> I have encountered some strange/wrong behavior of the round function in >>> R. >>> >>> This is the behavior on my mac laptop: >>> >>> R.version >>>> >>> _ >>> platform x86_64-apple-darwin13.0.2 >>> arch x86_64 >>> os darwin13.0.2 >>> system x86_64, darwin13.0.2 >>> status >>> major 3 >>> minor 0.2 >>> year 2013 >>> month 09 >>> day 25 >>> svn rev 63987 >>> language R >>> version.string R version 3.0.2 (2013-09-25) >>> nickname Frisbee Sailing >>> >>>> round(1.5) >>>> >>> [1] 2 >>> >>>> round(4.5) >>>> >>> [1] 4 >>> >>>> floor(1.5 + 0.5) >>>> >>> [1] 2 >>> >>>> floor(4.5 + 0.5) >>>> >>> [1] 5 >>> >>> This is the behavior on Ubuntu 12.04 running in a virtual machine on the >>> same mac: >>> >>> R.version >>>> >>> _ >>> platform x86_64-pc-linux-gnu >>> arch x86_64 >>> os linux-gnu >>> system x86_64, linux-gnu >>> status beta >>> major 3 >>> minor 1.0 >>> year 2014 >>> month 03 >>> day 28 >>> svn rev 65330 >>> language R >>> version.string R version 3.1.0 beta (2014-03-28 r65330) >>> nickname Spring Dance >>> >>>> round(1.5) >>>> >>> [1] 2 >>> >>>> round(4.5) >>>> >>> [1] 4 >>> >>>> floor(1.5 + 0.5) >>>> >>> [1] 2 >>> >>>> floor(4.5 + 0.5) >>>> >>> [1] 5 >>> >>> I would expect round(x.5) = x+1, which only happens sometimes. My >>> colleague >>> using R version 3.1.0 on Linux on a Lenovo laptop gets the expected >>> result >>> in all cases. >>> >>> Is this a bug or somehow expected behavior? It seems to be related to the >>> mac hardware. I can ad hoc fix it using floor, but that is hardly >>> optimal. >>> >>> Thanks, >>> Per >>> >>> [[alternative HTML version deleted]] >>> >>> _______________________________________________ >>> R-SIG-Mac mailing list >>> [email protected] >>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac >>> >> >> > [[alternative HTML version deleted]] _______________________________________________ R-SIG-Mac mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-mac
