Details
-
Type:
Bug
-
Status: Closed
-
Severity:
Urgent
-
Resolution: Fixed
-
Affects Version/s: 4.1.0 GA (Platform Release 3.7.0), 4.2.0 GA (4.0.0 GA Suite Release), 4.3.0 GA (4.5.0 GA Suite Release), 4.4.0 GA (4.8.0 GA Suite Release) , 5.0.0 GA (5.0.0 GA Suite Release)
-
Fix Version/s: 6.0.0 GA
-
Component/s: Step
-
Labels:
-
PDI Sub-component:
-
Notice:
-
Sprint Team:Maintenance
Description
This has not been reported yet, but was found by implementing the Calculator function STDROUND by PDI-1311 (New Calculator Calculation Type to support standard rounding) and creating validation samples:
ROUND (A)
- it uses round(ValueMetaInterface metaA, Object dataA) that performs a Math.round(): Returns the closest Integer to the argument
ROUND (A,B)
- uses not the Math.round but methods with the rounding method ROUND_HALF_EVEN
This leads to different rounding methods with or without precision, please see the attached example.
The newly implemented STDROUND (A) or STRDOUND (A,B) uses consistent ROUND_HALF_UP
Notes:
a) Since the implementation of PDI-1311, the different behavior is documented over here: http://wiki.pentaho.com/display/EAI/Calculator
b) By fixing the existing code, this would have backward compatibility impact
c) New rounding functions should be used when implementing a consistent rounding for:
1) Returns the closest Integer to the argument
2) Method "Round half to even"