[R-SIG-Mac] Math bug in Mavericks build

luke-tierney at uiowa.edu luke-tierney at uiowa.edu
Wed Apr 23 16:29:48 CEST 2014


This has the look of an over-zealous optimizer that doesn't understand
how 32-bit integer arithmetic works. It is possible to define a flag
to force using doubles to check for integer addition overflow if that
is needed for the compiler used here.

luke

On Wed, 23 Apr 2014, Erich Neuwirth wrote:

> Some more strange things:
>
>> 2000000000L+200000000L
> [1] -2094967296
>> 2000000000L*2L
> [1] NA
>> 2147483647L+2147483647L
> [1] -2
>
> (2147483647 = 2^31-1)
>
> So this looks like an integer overflow is not caught for addition, but it is for multiplication
>
>
>
> This is my R version:
>
>> sessionInfo()
> R version 3.1.0 (2014-04-10)
> Platform: x86_64-apple-darwin13.1.0 (64-bit)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney at uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the R-SIG-Mac mailing list