I have an .xlsx spreadsheet with a single number in the top-left cell of sheet 1.
The Excel UI displays:
-130.98999999999
This is v
This function should produce the same thing you see in the formula bar:
private static BigDecimal stringedDouble(Cell cell) {
BigDecimal result = new BigDecimal(String.valueOf(cell.getNumericCellValue())).stripTrailingZeros();
result = result.scale() < 0 ? result.setScale(0) : result;
return result;
}