Matching Excel's floating point in Java

后端 未结 6 1324
长发绾君心
长发绾君心 2020-12-11 02:06

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

6条回答
  •  暖寄归人
    2020-12-11 02:26

    As suggested by peter.petrov I would use BigDecimal for this. As mentioned it let's you import the data without loss and be always setting the scale to 15 you have the same behaviour as in Excel

提交回复
热议问题