# Why Combinatorics package doesn't warn of overflow?

This is dangerous, as the following code doesn’t emit any warning, just give very different results (I assume due to overflowing ???)

``````using Combinatorics

# 4 players get exactly one ace each:
sol1 = 4 * 3 *2 * multinomial(12,12,12,12)/multinomial(13,13,13,13) # 0 .838
sol2 = 4 * 3 *2 * (multinomial(12,12,12,12)/multinomial(13,13,13,13)) # -9.47
sol3 = 4 * 3 *2 * (multinomial(BigInt(12),12,12,12)/multinomial(BigInt(13),13,13,13)) # 0.105
sol4 = 4 * 3 *2 * multinomial(BigInt(12),12,12,12)/multinomial(BigInt(13),13,13,13) # 0.105
sol5 = 4 * 3 *2 * (multinomial(BigInt(12),BigInt(12),BigInt(12),BigInt(12))/multinomial(BigInt(13),BigInt(13),BigInt(13),BigInt(13))) # 0.105
``````

yep, not making it “big” by default, you can file an issue maybe

1 Like

yep… interesting, I thought the overflow error was a “safety net” of the language, while it is instead a check specifically implemented in the `binomial` function… so, if the individual `binomial` computation in `multinomial` doesn’t overflow, neither does `multinomial`, e.g.

`multinomial(150, 150, 150, 150)` --> error overflow
`multinomial(15, 15, 15, 15)` --> no error reported

right; Julia by default does not check overflow, for performance reason, similar to C/C++. But pkgs like Combinatorics I’d imagine have good reason to either make `big` by default(see for example `derangement` function), or check overflow.

3 Likes