[Rd] function min does not return correct result if .Machine$integer.max is involved (PR#8731)

schlather at hsu-hh.de schlather at hsu-hh.de
Thu Mar 30 12:34:17 CEST 2006


Full_Name: Martin Schlather
Version: 2.2.0 and alpha 2.3.0 (06/3/29)
OS: Linux (x86_64 and Intel)
Submission from: (NULL) (139.11.183.106)


> min(.Machine$integer.max, 10^20)
[1] 1e+20

> min(as.integer(.Machine$integer.max), 10^20)
[1] 1e+20


but
> min(.Machine$integer.max + 0, 10^20)
[1] 2147483647

> min(as.integer(.Machine$integer.max - 1), 10^20)
[1] 2147483646

> min(as.double(.Machine$integer.max), 10^20)
[1] 2147483647

Cheers, Martin



More information about the R-devel mailing list