CNP |
cnp calculates the number (N) of combinations of OBJects used from P to P.
cnp(n, p)
|
Element |
Description |
Restrictions |
|
n |
Whole Number |
0 <= n < 2^31 |
|
p |
Whole Number |
0 <= p <= n |
NBCOMB = cnp(N*2, len(C))
SOMPUIS = sigma(I=0, N, cnp(N,I) * X^I * Y^(N-I))
cnp(N,P) returns fac(N) / (fac(P) * fac(N-P)).
So as not to lose any precision in the calculation, Adonix does not use the fac function, which allows for extended domains of use for (n, p).
cnp truncates n and p if they are not whole numbers.
The result is one of the following types:
· Integer if cnp(n, p) < 2^31-1
· Otherwise, Decimal
|
Error |
Description |
|
ERHUGE (13) |
Capacity exceeded during the calculation |
|
ERDOM (50) |
Domain error (n<0, p<0, or n<p). |
|
|