From bolker at zoo.ufl.edu  Mon Jan  9 03:24:51 2006
From: bolker at zoo.ufl.edu (Ben Bolker)
Date: Sun, 08 Jan 2006 21:24:51 -0500
Subject: [Rd] prod(numeric(0)) surprise
Message-ID: <43C1C973.8080702@zoo.ufl.edu>


   It surprised me that prod(numeric(0)) is 1.
I guess if you say (operation(nothing) == identity
element) this makes sense, but ??

    Looking in the code, this makes sense:
basically (s=1; for i=0 to length(x),
multiply s by x[i]) -- which comes out to 1.

   What *should* prod(numeric(0)) produce?
I couldn't find the answer documented anywhere.

   (And how about sum(numeric(0))==0,
which for some reason makes more intuitive sense
to me, but is really exactly the same thing --
consider exp(sum(log(numeric(0)))) ... ?)

   cheers
     Ben Bolker

-- 
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



[Rd] prod(numeric(0)) surprise
Ben Bolker