Skip to content

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

@MarkBaker

Description

@MarkBaker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions