R-alpha: wierdness with choose() and vector()

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Thu, 5 Sep 1996 09:49:56 +1200

Date: Thu, 5 Sep 1996 09:49:56 +1200
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Message-Id: <199609042149.JAA02093@stat.auckland.ac.nz>
To: r-testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: wierdness with choose() and vector()
In-Reply-To: <Pine.SUN.3.91.960904124725.966A-100000@spock>

Gregory R. Warnes writes:
 > I've noticed a bug with choose: It should return an exact _integer_ value,
 > but currently returns a _real_ which is only close to the correct integer.

Choose works by using the obvious formula with the log-gamma function.
It's done that way so that very large argumnents will still give an
approximate answer.  E.g.

	> choose(100,50)
	[1] 1.008913e+29

What I can do is to return an exactly rounded value when the answer is
below some threshold.  Perhaps the natural threshold is the maximum
representable integer, although something larger is possible because
we are using 64-bit reals.

If there are no objections I'll make this change.
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