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

0 raised to power of n, where n is negative number with more than 15 digits returns 0 (not Infinity) #338

Closed
Kolobamanacas opened this issue Nov 21, 2022 · 2 comments
Labels

Comments

@Kolobamanacas
Copy link

Repro steps:

import BigNumber from "bignumber.js";

console.log(new BigNumber(0).exponentiatedBy('-123456789012345').toString()) // Returns Infinity (ok).
console.log(new BigNumber(0).exponentiatedBy('-12345678901234567890123456789012345678901234567890').toString()) // Returns 0 (seems like not ok).

It seems to me, that this behavior is somewhat inconsistent and zero raised to power of negative number should return Infinity independent from power's length.

@MikeMcl
Copy link
Owner

MikeMcl commented Nov 21, 2022

Yes, it's a bug. Thanks for the report. I'll see to it presently.

@MikeMcl MikeMcl added the bug label Nov 21, 2022
MikeMcl added a commit that referenced this issue Dec 4, 2022
@MikeMcl
Copy link
Owner

MikeMcl commented Dec 4, 2022

Fixed in v9.1.1.

@MikeMcl MikeMcl closed this as completed Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants