prod(numeric(0)) surprise
Duncan Murdoch wrote:
On 1/8/2006 9:24 PM, Ben Bolker wrote:
It surprised me that prod(numeric(0)) is 1. I guess if you say (operation(nothing) == identity element) this makes sense, but ??
What value were you expecting, or were you expecting an error? I can't think how any other value could be justified, and throwing an error would make a lot of formulas more complicated.
That's a fairly standard mathematical convention, which is presumably why sum and prod work that way. Duncan Murdoch
OK. I guess I was expecting NaN/NA (as opposed to an error),
but I take the "this makes everything else more complicated" point.
Should this be documented or is it just too obvious ... ?
(Funny -- I'm willing to take gamma(1)==1 without any argument
or suggestion that it should be documented ...)
cheers
Ben
620B Bartram Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704