G'day Martin,

On Mon, 21 Apr 2008 18:40:43 +0200
Martin Maechler <[EMAIL PROTECTED]> wrote:

> I think most of us would expect  prod(0:1000)  to return 0, and ...
> ... it does.
> 
> However, many of us also expect  
>   prod(x1, x2)    to be equivalent to
>   prod(c(x1,x2))
> the same as we can expect that for min(), max(), sum() and such
> members of the "Summary" group.

Many may also expect that prod(x) and prod(rev(x)) are equivalent.
Unfortunately, this does not hold in finite precision arithmetic:

> prod(0:1000)
[1] 0
> prod(1000:0)
[1] NA
> prod(rev(0:1000))
[1] NA

It might be better to educate useRs on finite precision arithmetic
than trying to catch such situations.  Note, I am saying "better", not
"easier". :-)  

Cheers,
        
        Berwin

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to