pls chk o s On Tue, 9 Sept 2025 at 22:36, <[email protected]> wrote:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=69812 > > Bug ID: 69812 > Summary: Incorrect Rounding in DataFormatter > Product: POI > Version: 5.4.1-FINAL > Hardware: PC > OS: Mac OS X 10.1 > Status: NEW > Severity: normal > Priority: P2 > Component: POI Overall > Assignee: [email protected] > Reporter: [email protected] > Target Milestone: --- > > When using the "millions" format on a number in Excel, #,##0,, the > formatted > value that is produced can be incorrectly rounded. > > With the cell value "25396277490", Excel shows a value of "25,396" > > DataFormatter produces a value of "25,400" > > Stepping through the debugger, everything looks correct until > > https://github.com/apache/poi/blob/559485a0fe2735c1ecab7d343a45f5d0bd1877e1/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java#L971 > > I believe using the double value of the cell causes floating point rounding > errors. > > If you replace numberFormat.format(BigDecimal.valueOf(d)) with > numberFormat.format(new BigDecimal(((XSSFCell) cell).getRawValue())) the > output > is correct > > -- > 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] > >
