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

InfiniteMath.log doesn't support numbers over 1e+308. #29

Closed
KdudeDev opened this issue Jun 8, 2023 · 1 comment
Closed

InfiniteMath.log doesn't support numbers over 1e+308. #29

KdudeDev opened this issue Jun 8, 2023 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@KdudeDev
Copy link
Owner

KdudeDev commented Jun 8, 2023

Attempting to use InfiniteMath.log with a number over 1e+308, for example 1e+1000, will error.

The function uses math.log(10^second, Base) to calculate second, but this results in a number over 1e+308.

@KdudeDev KdudeDev added bug Something isn't working help wanted Extra attention is needed labels Jun 9, 2023
@KdudeDev
Copy link
Owner Author

KdudeDev commented Jun 9, 2023

This issue has been fixed. The old implementation of log was math.log(first, Base) + math.log(10^second, Base).

Doing 10^second will obviously go over the float limit, which causes INF.

The new implementation is math.log(first, Base) + second * math.log(10, Base)

This little work around gives the same result mathematically but doesn't cause second to go over 10^308.

@KdudeDev KdudeDev closed this as completed Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant