出現 Non-terminating decimal expansion; no exact representable decimal result 問題的解決方法

代碼中使用了 BigDecimal 做精確計算,在做除法時,系統拋出 「 Non-terminating decimal expansion; no exact representable decimal result」。 1 分析 BigDecimal 是不可變的、任意精度的有符號十進制數,所以可以做精確計算。但在除法中,準確的商可能是一個無限長的十進制擴展;例如,1 除以 3 所得的商。我們在
相關文章
相關標籤/搜索