From Henrik.Seidel at schering.de  Wed Jul  9 19:22:05 2003
From: Henrik.Seidel at schering.de (Henrik.Seidel@schering.de)
Date: Wed Jul  9 18:22:00 2003
Subject: [Rd] I am puzzled about something in pnorm in R (PR#3443)
Message-ID: <200307091622.h69GM5JH012832@pubhealth.ku.dk>

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@schering.de, http://www.schering.de


[Rd] I am puzzled about something in pnorm in R (PR#3443)
Henrik.Seidel@schering.de