Skip to content

DOLLARDE() and DOLLARFR() miscalculation with negative numbers #2578

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
MarkBaker opened this issue Feb 11, 2022 · 1 comment
Closed

DOLLARDE() and DOLLARFR() miscalculation with negative numbers #2578

MarkBaker opened this issue Feb 11, 2022 · 1 comment

Comments

@MarkBaker
Copy link
Member

This is:

- [X] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

When splitting the dollars value to integer/decimal, floor() is used for the integer part. This results in the result for negative values being incorrect by -1

What is the expected behavior?

=DOLLARDE(-3.75,4) should give a result of -4.85
=DOLLARDE(-3.75,4) should give a result of -3.3

What is the current behavior?

=DOLLARDE(-3.75,4) gives a result of -5.85
=DOLLARDE(-3.75,4) gives a result of -4.3

Which versions of PhpSpreadsheet and PHP are affected?

ALL

@MarkBaker
Copy link
Member Author

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant