https://issues.apache.org/bugzilla/show_bug.cgi?id=56741

            Bug ID: 56741
           Summary: [PATCH] Floating point rounding problems with
                    ROUNDDOWN function
           Product: POI
           Version: 3.11-dev
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: [email protected]
          Reporter: [email protected]

Similar to the patch provided in Bug 56315
the ROUNDDOWN() function is not behaving like excel and required a similar
patch as for the ROUND() function.

New code

public static double roundDown(double n, int p) {
 double retval;
 if (Double.isNaN(n) || Double.isInfinite(n)) {
   retval = Double.NaN;
 } else {
   retval = new BigDecimal(NumberToTextConverter.toText(n)).setScale(p,
java.math.RoundingMode.DOWN).doubleValue();
 }
 return retval;
}

I will provide a patch, unit tests and integration test FormulaEvalTestData.xls
soon

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to