charredgrass / charred-discord-bot

Personal Discord bot. Written in Typescript, run using node.js.
MIT License
1 stars 1 forks source link

statmath commands do not work with larger numbers #49

Open charredgrass opened 3 years ago

charredgrass commented 3 years ago

in statmath.js, binomcoeff fails if n is too large to take a factorial of, even if the expected result would fit into a js Number.

Example: binomcoeff(2048, 2) should return 2096128 but returns NaN because of the factorials.

possible solution is to use bigint or use a different way to calculate binomcoeff