Post Reply 
Permutations & Combinations for large inputs
05-30-2015, 01:07 PM (This post was last modified: 05-30-2015 01:15 PM by Dieter.)
Post: #9
RE: Permutations & Combinations for large inputs
(05-27-2015 12:27 PM)Werner Wrote:  Only for n<16 I'm afraid.
eg. PERM(16,5) = 16!/(11!) = 524160.0001.

Yes, deviations like this can occur if one of the operands cannot be represented exactly with 10 digits.
Here 16! is 20 922 789 888 000 which is rounded to 2,092278989 E+13.

(05-27-2015 12:27 PM)Werner Wrote:  There's 110 cases like this for n<70.
These can be corrected with 0.1 + INT.

That's the lazy solution. Too bad there is no ROUNDI on the '41. ;-)

(05-27-2015 12:27 PM)Werner Wrote:  Worst case is PERM(64,5) = 914941440.4

Then there are a few cases with a wrong result of exactly 10 significant digits:
...
All of these are larger than 1e10 though, so you're at least able to deliver correct results less than 1e10

I suggested an upgrade to the combinations routine of the Binomial program that is discussed in another thread in this forum. Here the denominator loop counts up so that the intermediate results are integers.

On the other hand, there is no chance to reliably get a result with 10 exact digits if the calculator works with the same 10-digit precision. So a slight error in the last digit might be acceptable.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Permutations & Combinations for large inputs - Dieter - 05-30-2015 01:07 PM



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