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

Tweak for AMORDEGRC #4164

Merged
merged 3 commits into from
Sep 15, 2024
Merged

Tweak for AMORDEGRC #4164

merged 3 commits into from
Sep 15, 2024

Conversation

oleibman
Copy link
Collaborator

@oleibman oleibman commented Sep 7, 2024

Changes to Php8.4 floating point calculations caused failures in unit tests for ROUNDDOWN, ROUNDUP, and AMORDEGRC. These were addressed in a kludgey manner by PR #3897. Then someone reported a problem (not specifically related to Php8.4) with TRUNC. That was fixed by PR #4115, in which I applied the method used by TRUNC to ROUNDDOWN and ROUNDUP as well. The method used to fix these was to cast a floating point value to string and then cast it back to float again. It's a bit surprising that this works, but it seems effective for all our test cases, and is less kludgey than what had been done earlier. Missing from that PR was a similar change for AMORDEGRC. This PR applies that change to AMORDEGRC, which again passes the unit test suite for all releases of Php.

This is:

  • a bugfix
  • a new feature
  • refactoring
  • additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Why this change is needed?

Provide an explanation of why this change is needed, with links to any Issues (if appropriate).
If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.

Changes to Php8.4 floating point calculations caused failures in unit tests for ROUNDDOWN, ROUNDUP, and AMORDEGRC. These were addressed in a kludgey manner by PR PHPOffice#3897. Then someone reported a problem (not specifically related to Php8.4) with TRUNC. That was fixed by PR PHPOffice#4115, in which I applied the method used by TRUNC to ROUNDDOWN and ROUNDUP as well. The method used to fix these was to cast a floating point value to string and then cast it back to float again. It's a bit surprising that this works, but it seems effective for all our test cases, and is less kludgey than what had been done earlier. Missing from that PR was a similar change for AMORDEGRC. This PR applies that change to AMORDEGRC, which again passes the unit test suite for all releases of Php.
oleibman added a commit that referenced this pull request Sep 8, 2024
Backports of PR #4162 and PR #4164 intended for Php 3.0.0.


Signed-off-by: oleibman <[email protected]>
oleibman added a commit that referenced this pull request Sep 8, 2024
Backports of PR #4162 and PR #4164 intended for 3.0.0.
@oleibman oleibman added this pull request to the merge queue Sep 15, 2024
Merged via the queue into PHPOffice:master with commit c91c8c9 Sep 15, 2024
13 checks passed
@oleibman oleibman deleted the amordegrc branch September 15, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant