Skip to content

ext/bcmath: Fixed the sign to be PLUS if the result is 0 - #15599

Merged
SakiTakamachi merged 1 commit into
php:masterfrom
SakiTakamachi:bcmath/fix_result_is_zero
Aug 27, 2024
Merged

ext/bcmath: Fixed the sign to be PLUS if the result is 0#15599
SakiTakamachi merged 1 commit into
php:masterfrom
SakiTakamachi:bcmath/fix_result_is_zero

Conversation

@SakiTakamachi

Copy link
Copy Markdown
Member

This does not affect existing functions at all, but when comparing on BcMath\Number objects, mixing 0 and -0 will result in unintended behavior, so modify it so that the sign is always PLUS for 0 .

@cmb69

Copy link
Copy Markdown
Member

Maybe add a test case for this?

@SakiTakamachi

SakiTakamachi commented Aug 27, 2024

Copy link
Copy Markdown
MemberAuthor

@cmb69
There is no effect on existing functions (because the calculation results are converted to strings each time instead of being retained as a structure), so cannot write tests on the current master.

edit:
I could include this in the RFC implementation PR, but since it's already over 5000 lines, I thought it might be better to separate it other PR.

@SakiTakamachi
SakiTakamachi merged commit 674ec02 into php:masterAug 27, 2024
@SakiTakamachi
SakiTakamachi deleted the bcmath/fix_result_is_zero branch August 27, 2024 23:48
Sign up for freeto 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

@SakiTakamachi@cmb69@ndossche