Skip to content

Math bug in Mavericks build

4 messages · Dan Tenenbaum, Peter Dalgaard, Erich Neuwirth +1 more

#
Hello Simon & Co.,

On R-3.1.0, Mavericks build:
[1] -2092967276

On R-3.1.0, Snow Leopard build:
[1] NA
Warning message:
In 1980000020L + 222000000L : NAs produced by integer overflow

A bug, perhaps?

Mavericks 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     

Snow Leopard sessionInfo():

R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin10.8.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     

Thanks,
Dan
#
Dunno if it helps anyone, but a check of local builds lying around shows the issue in

R version 3.0.2 Patched (2013-11-19 r64260) -- "Frisbee Sailing"

but NOT in

R Under development (unstable) (2013-11-11 r64196) -- "Unsuffered Consequences"

So, it seems that either we introduced a change during that period or the build tools changed. Those builds might not be entirely clean, though.

As for C compiler, my current setup has

Peters-iMac:~ pd$ ls -l `which gcc`
-rwxr-xr-x  1 root  wheel  14224 Oct 29 18:10 /usr/bin/gcc
Peters-iMac:~ pd$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
On 23 Apr 2014, at 08:39 , Dan Tenenbaum <dtenenba at fhcrc.org> wrote:

            

  
    
#
Some more strange things:
[1] -2094967296
[1] NA
[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:
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     

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20140423/14c7e7df/attachment-0001.bin>
#
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: