R-alpha: More on choose()

Douglas Bates (bates@stat.wisc.edu)
Wed, 4 Sep 96 16:46 CDT

Message-Id: <m0uyPmY-0000TzC@franz.stat.wisc.edu>
Date: Wed, 4 Sep 96 16:46 CDT
From: Douglas Bates <bates@stat.wisc.edu>
To: R-testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: More on choose()

The earlier posting on choose motivated me to look at the code in 
The function fastchoose looks like an infinite recursion to me

 double fastchoose(double n, double k)
	 return exp(fastchoose(n, k));
It is never called anywhere else in the file but I still think you
might want to change the last call to lfastchoose.

As for the original question, would there be a problem with changing
the definition of choose to return

        return floor(exp(lfastchoose(n, k)) + 0.5);

In other words, does the IEEE floating point spec have floor do the
"right thing" when the argument is beyond the range of the integer or
long integer representation.

Douglas Bates                            bates@stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch