Post Reply 
Permutations & Combinations for large inputs
05-27-2015, 12:27 PM
Post: #8
RE: Permutations & Combinations for large inputs
(05-26-2015 05:14 PM)Dieter Wrote:  Since the program calculates n!/(n–r)! first (which always is an integer) the results should be exact here.
Only for n<16 I'm afraid.
eg. PERM(16,5) = 16!/(11!) = 524160.0001. There's 110 cases like this for n<70.
These can be corrected with 0.1 + INT.
Worst case is PERM(64,5) = 914941440.4

Then there are a few cases with a wrong result of exactly 10 significant digits:
PERM(31,9) = 7.315688014e12 (exact 7.315688016e12)
PERM(35,8) = 8.489642628e11 (exact 8.489642624e11)
PERM(38,7) = 6.360609025e10 (exact 6.360609024e10)
39 7
45 7
52 7
54 7
59 6
61 6
64 6
68 6

All of these are larger than 1e10 though, so you're at least able to deliver correct results less than 1e10

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
RE: Permutations & Combinations for large inputs - Werner - 05-27-2015 12:27 PM



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