Skip to content

Fix GH-11761: Bcmath numbers with trailing zeros #11798

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

Conversation

jorgsowa
Copy link
Contributor

This PR improves the performance of the BC extension computations for the decimal numbers with trailing zeros. Specifically we get Memory limit error while we want to raise zero with many trailing zeros to large exponent. Example: https://onlinephp.io/c/dcd86
Also it may improve other special cases of operations with number zero, like multiplying with number zero.

Changes made:

  • while we transform the number from string to bc_num we strip of the trailing zeros lower the scale.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Girgias Girgias merged commit 549c657 into php:master Jul 26, 2023
jorgsowa added a commit to jorgsowa/php-src that referenced this pull request Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants