Post Reply 
(Free42) not a bug - COMB
07-13-2020, 11:36 AM
Post: #1
(Free42) not a bug - COMB
.. but an easy fix for a tiny 'problem'.
COMB obviously computes the result as

n/1*(n-1)/2*(n-2)/3...*(n-p)/p

But it will give an Out of Range error for eg C(20408,10204) while the result is 1.47e6141, well within range. That can easily be fixed computing COMB as

1E-5*n/1*(n-1)/2*(n-2)/3...*(n-p)/p*1E5

This will allow up to COMB(20420,10210), and 10210 is the largest value p for which C(n,p) doesn't overflow but C(n,p)*p does (the last value in the chain calculation before the final division by p), so 1E-5 is sufficiently small. 1E-4 is not ;-)

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(Free42) not a bug - COMB - Werner - 07-13-2020 11:36 AM
RE: (Free42) not a bug - COMB - Paul Dale - 07-13-2020, 12:03 PM
RE: (Free42) not a bug - COMB - Werner - 07-13-2020, 12:22 PM
RE: (Free42) not a bug - COMB - Werner - 07-13-2020, 01:16 PM
RE: (Free42) not a bug - COMB - Werner - 07-13-2020, 12:28 PM
RE: (Free42) not a bug - COMB - Werner - 07-14-2020, 06:57 AM



User(s) browsing this thread: 1 Guest(s)