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

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Mar 30 13:38:38 CEST 2006


schlather at hsu-hh.de writes:

> 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

I have a vague recollection that we might have used
.Machine$integer.max to represent "integer infinity" at some point. If
so, then the results make some sense, but we don't seem to have
similar conventions in any other places that I can think of (i.e.
as.integer(Inf) is NA, etc.)

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-devel mailing list