[Rd] I am puzzled about something in pnorm in R (PR#3443)

Henrik.Seidel at schering.de Henrik.Seidel at schering.de
Wed Jul 9 19:22:05 MEST 2003


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?


 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