mean of complex vector (PR#8842)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

mean of complex vector (PR#8842)

john.peters
Full_Name: John Peters
Version: 2.3.0
OS: Windows 2000, xp
Submission from: (NULL) (220.233.20.203)


In R2.3.0 on Windows 2000 and xp

> mean(c(1i))
[1] 0+2i
> mean(c(1i,1i))
[1] 0+3i
> mean(c(1i,1i,1i))
[1] 0+4i

OK in R2.2.1

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: mean of complex vector (PR#8842)

Peter Dalgaard
[hidden email] writes:

> Full_Name: John Peters
> Version: 2.3.0
> OS: Windows 2000, xp
> Submission from: (NULL) (220.233.20.203)
>
>
> In R2.3.0 on Windows 2000 and xp
>
> > mean(c(1i))
> [1] 0+2i
> > mean(c(1i,1i))
> [1] 0+3i
> > mean(c(1i,1i,1i))
> [1] 0+4i
>
> OK in R2.2.1

Yes. This comes from a blunder in summary.c, apparently attempting to
copy the code from the REALSXP case, mutatis mutandis, but not quite so...

--
   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
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel