Martin Maechler
1998-May-06 10:01 UTC
min(numeric(0)) = ? -- proposal for "S incompatible change"
[Same question for max(.), cummin(.) and cummax(.)]
In S, S-plus and R, this currently gives NA.
I wonder if it wouldn't make more sense to follow common
mathematical/logical reasoning here:
min { empty set } = +Inf
max { empty set } = -Inf
(For integers, these would be INT_MAX and INT_MIN, respectively).
Maybe this is a real ``first time'':
I am proposing a change which would lead from
"S compatible" to "S incompatible"
{since I don't expect S to change,
given my recent experience with my plea to change 'n %% m'
(for negative n or m, the result DIFFERS, depending on
storage.mode = "integer" or "double" !!!)
Note that I've spent quite a bit more thought on the "%%" issue
than on this one!
Comments?
Pros/ Cons?
Martin Maechler <maechler@stat.math.ethz.ch> <><
Seminar fuer Statistik, ETH-Zentrum SOL G1; Sonneggstr.33
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1086
http://www.stat.math.ethz.ch/~maechler/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
My last message stated something wrong:
In R 0.62, we already have
> min(numeric(0))
[1] Inf
> max(numeric(0))
[1] -Inf
> max(integer(0))
[1] -Inf
> min(integer(0))
[1] Inf
The only change I'd propose is to return 'integer' if all arguments
are
'integer', i.e., e.g.,
min(integer(0)) would return .Machine$int.max
Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._