Bug 378119

Summary: RoundFloor doesn't work as expected with negative numbers
Product: [Frameworks and Libraries] libalkimia Reporter: NSLW <lukasz.wojnilowicz>
Component: GeneralAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED NOT A BUG    
Severity: normal CC: onet.cristian, thb
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description NSLW 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 NSLW 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.