62839
2018-10-19 16:00:15 +0000
MathX.floor for negative n
2018-12-28 07:08:44 +0000
1
1
1
Unclassified
POI
SS Common
4.0.0-FINAL
PC
Linux
RESOLVED
FIXED
P2
normal
---
1
poi
dev
0
oldest_to_newest
207797
0
poi
2018-10-19 16:00:15 +0000
Behavior in LibreOffice / Excel:
The result of function call FLOOR.XCL(-123;10) in LibreOffice 6.1.2.1 is -130.
The result in Excel Office 365 is also -130.
The result in POI 4.0.0 via cell.getNumericCellValue() is -130.0.
Problem:
The result of new DataFormatter().formatCellValue(cell, formulaEvaluator) is #NUM!.
Expected result:
I suppose that the result in POI also should be -130.
Idea for improvement:
Remove the condition (n<0 && s>0) in the if-statement in org.apache.poi.ss.formula.functions.MathX.floor(double, double)
And I suggest that the condition (s==0 && n!=0) in org.apache.poi.ss.formula.functions.MathX.floor(double, double) could be removed also. Excel returns 0 for floor(0;10) and LibreOffice also returns 0.
I guess that org.apache.poi.ss.formula.functions.MathX.ceiling(double, double) has already been changed this way, because the docs tell about negative n, but the if-statement does not check that.
209548
1
dominik.stadler
2018-12-26 13:37:28 +0000
Fixed via r1849764.
209564
2
poi
2018-12-28 07:08:44 +0000
Thank you! :-)