[Rd] Re: I am puzzled about something in pnorm in R (PR#3545)

organism at ices.utexas.edu organism at ices.utexas.edu
Thu Jul 24 05:15:00 MEST 2003


sorry for the late reply.  i dunno if anyone ever wrote you back.

although perhaps not written for clarity, i think what appears in the code 
is correct.  the routine only guarantees that one of cum or ccum has a 
valid return value depending on i_tail (the other might as well be 
garbage, but that isn't what's returned).

j


On Wed, 9 Jul 2003 Henrik.Seidel at schering.de wrote:
> Hello,
> 
> I am a bit puzzled about the "swap_tail" macro in pnorm.c of the R sources.
> I cite:
> 
> #define swap_tail                               \
>  if (x > 0.) {/* swap  ccum <--> cum */               \
>      temp = *cum; if(lower) *cum = *ccum; *ccum = temp;     \
>  }
> 
>  It appears to me that ccum and cum should be swapped if x>0 and if lower.
>  However, here we get the following result:
> 
>  1.) x > 0 and lower: ccum will get the old value of cum, cum will get the
>  old value of ccum, so both are swapped
>  2.) x > 0 and not lower: ccum will get the old value of cum, but cum will
>  keep its old value, so values are not swapped but both values are set to
>  the original value of cum
> 
>  Is this the expected behavior?
> 
>  Regards
>  Henrik
> 
>  --
>  Dr. Henrik Seidel, physicist/research scientist in bioinformatics
>  Schering AG, Enabling Technologies, Genomics/Bioinformatics, S109/7/717b,
>  D-13342 Berlin, Germany, Tel.: +49 30 468 16683, Fax.: +49 30 468 96683,
>  Mobile: +49 179 9416872, henrik.seidel at schering.de, http://www.schering.de



More information about the R-devel mailing list