Immutable objects which encapsulate the context settings which describe certain rules for numerical operators,such as those implemented by the BigDecimal class.
However, the compareTo() method will consider them to be equal, so you should use compareTo() instead of equals()when comparing two BigDecimal values numerically.
但要小心使用BigDecimal(double)构造函数,因为它会在计算的过程中产生舍入误差。
You should be careful with the BigDecimal(double) constructor because it can allow rounding errors to sneak into your calculations before you know it.
Improper use of the BigDecimal(double) constructor can show up as strange-seeming exceptions in JDBC drivers when passed to the JDBC setBigDecimal() method.
Instead, construct the BigDecimal using BigDecimal("0.01") or BigDecimal(1, 2) to avoid this problem, since either of these will result in an exact decimal representation.
中文
Bahasa indonesia
日本語
عربى
Български
বাংলা
Český
Dansk
Deutsch
Ελληνικά
Español
Suomi
Français
עִברִית
हिंदी
Hrvatski
Magyar
Italiano
Қазақ
한국어
മലയാളം
मराठी
Bahasa malay
Nederlands
Norsk
Polski
Português
Română
Русский
Slovenský
Slovenski
Српски
Svenska
தமிழ்
తెలుగు
ไทย
Tagalog
Turkce
Українська
اردو
Tiếng việt