Post Reply 
Permutations & Combinations for large inputs
05-31-2015, 07:37 AM (This post was last modified: 05-31-2015 07:37 AM by Ángel Martin.)
Post: #11
RE: Permutations & Combinations for large inputs
(05-27-2015 12:27 PM)Werner Wrote:  
(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

The NCR and NPR functions on the SandMath can be a good reference. Since they use internal 13-digit accuracy the results are pretty much right on, always integers (no, there isn't any rounding done by the function in case you wonder).

But I'm positive Dieter will find a counter-example to this rule as soon as he starts using the SandMath on V41 ;-)

Cheers,
'AM

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Permutations & Combinations for large inputs - Ángel Martin - 05-31-2015 07:37 AM



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