Bug 378119 - RoundFloor doesn't work as expected with negative numbers
Summary: RoundFloor doesn't work as expected with negative numbers
Status: RESOLVED NOT A BUG
Alias: None
Product: alkimia
Classification: Frameworks and Libraries
Component: General (show other bugs)
Version: master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-26 18:53 UTC by wojnilowicz
Modified: 2017-03-29 12:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wojnilowicz 2017-03-26 18:53:44 UTC
Problematic function is convertDenominator which doesn't work as expected with negative numbers.

case 1:
input = -1.009
output = -1.01
desired output = -1

case 2:
input = 1.009
output = desired output = 1

RoundFloor doesn't work as in LibreOffice.
Comment 1 Christoph Feck 2017-03-29 00:34:21 UTC
Which standard says LibreOffice is correct? Mathematically, rounding to floor always means rounding _down_, in other words, the result is not greater than the input.
Comment 2 wojnilowicz 2017-03-29 12:59:31 UTC
(In reply to Christoph Feck from comment #1)
> Which standard says LibreOffice is correct? Mathematically, rounding to
> floor always means rounding _down_, in other words, the result is not
> greater than the input.

You're right. LO is not standard.