Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instances of lack of support for bigints #3344

Open
gwhitney opened this issue Jan 3, 2025 · 1 comment · May be fixed by #3345
Open

instances of lack of support for bigints #3344

gwhitney opened this issue Jan 3, 2025 · 1 comment · May be fixed by #3345
Labels

Comments

@gwhitney
Copy link
Collaborator

gwhitney commented Jan 3, 2025

Describe the bug
We are starting to use mathjs 14 with bigint support in the Numberscope project, naturally shaking out some points concerning overall support for bigints. This issue collects four issues, for the sake of the PR for them I am about to file.

  1. mathjs crashes if a bigint is used in a non-type-homogeneous instance of max or min.
  2. if randomInt is called with bigint parameters, it returns a number, rather than a bigint.
  3. randomInt cannot handle a range wider than the precision of a number (2^53).
  4. log, log2, and log10 do not succeed on all bigint inputs.

To Reproduce

math.max(10n, 3, new BigNumber(7), fraction(3, 4))
math.randomInt(0n, 6n) // returns 0, 1, 2, 3, 4, or 5, not 0n, 1n, 2n, 3n, 4n, or 5n.
math.randomInt(0n, 10000000000000000n) // does not choose uniformly; many outputs impossible
math.log(10000000000000000n) // fails in implicit bigint->number conversion
@gwhitney gwhitney linked a pull request Jan 3, 2025 that will close this issue
@josdejong
Copy link
Owner

We are starting to use mathjs 14 with bigint support in the Numberscope project

Happy to hear that! I'll review your PR asap.

@gwhitney gwhitney added the bug label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants