Skip to content

Feature GH-12143: Extend the maximum precision round can handle by one digit #12222

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

Closed

Conversation

SakiTakamachi
Copy link
Member

@SakiTakamachi SakiTakamachi commented Sep 16, 2023

Please check here for more details.
#12143 (comment)

In the existing implementation, for example, the following code does not perform rounding:

<?php
var_dump(round(0.12345678901234565, 16, PHP_ROUND_HALF_UP));
// float(0.12345678901234565)

// I want it to be like this
// float(0.1234567890123457)

In this example, the maximum value that can be specified for round() argument $precision is 15.

This pull request changes round() to accept one more fine digit. (16 for the above example)


The test will probably not succeed unless it incorporates the changes in #12220.
Also, this PR also includes changes in #12162.

Therefore, you may not be able to accurately check this PR until after these two changes have been merged.

@SakiTakamachi SakiTakamachi marked this pull request as draft September 16, 2023 08:30
@TimWolla
Copy link
Member

@SakiTakamachi Can you rebase this, now that #12220 is merged?

@SakiTakamachi SakiTakamachi force-pushed the feature/expand-rounding-target branch from 082e637 to e330e0b Compare September 20, 2023 00:06
@SakiTakamachi
Copy link
Member Author

@TimWolla
done.

@SakiTakamachi
Copy link
Member Author

The digit adjustment is not going well, I am currently fixing it.

@SakiTakamachi
Copy link
Member Author

This is a malfunction caused by expanding the accepted digits, so there is no problem with the digit adjustment fix PR itself.

@SakiTakamachi SakiTakamachi force-pushed the feature/expand-rounding-target branch 4 times, most recently from 31304be to 6e9ade7 Compare February 10, 2024 14:17
@SakiTakamachi SakiTakamachi marked this pull request as ready for review February 10, 2024 14:17
@SakiTakamachi SakiTakamachi force-pushed the feature/expand-rounding-target branch from 6e9ade7 to fb41f0f Compare February 10, 2024 14:44
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.

One thing that would make it easier to see what changes in these sorts of PRs is to use the rules LLVM has for PRs.

First commit the test with the current behaviour, then do a follow-up commit with the C changes and how it impacts the test.

@SakiTakamachi
Copy link
Member Author

Thanks, I'll try that

@SakiTakamachi
Copy link
Member Author

@Girgias
First, I created a PR just to add a test to the existing implementation.
#13399

@SakiTakamachi SakiTakamachi force-pushed the feature/expand-rounding-target branch from fb41f0f to efdc240 Compare February 21, 2024 23:48
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, could you add an UPGRADING note when merging?

@SakiTakamachi SakiTakamachi deleted the feature/expand-rounding-target branch February 22, 2024 16:14
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.

3 participants