Skip to content
Prev 15702 / 398500 Next

inconsistency between gamma and choose functions

Hi,

the problem is much more general than R and gamma().  There are two ways to
store numbers in computers -- as integers and as reals.  The integer
calculations are exact (so long you do not receive overflow), calculations
with real numbers generally isn't (gamma() works with real numbers).  The
precision is always finite and many of the nice mathematical formulas fail
to work.  You should never expect that sin(x)^2 + cos(x)^2 == 1 or
sqrt(x)^2 == x although it sometimes happens.  Rather than writing

if( real1 == real2) {

one should always consider

if( abs( real1 - real2) < very.small.number) {

This is a fundamental problem with digital computing but at least I do not
see any other efficent ways how the computers could work (I do not know much
about quantum computing, however).


Regards,

Ott Toomet
On Fri, 14 Dec 2001, Cowpertwait, Paul wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._