I can understand that in BigDecimals 2.0 is not equal to 2.00 because 2.00 actually uses more precision digits. What I struggle to understand is why 2E+1
is not considered to be equal to 20
because both numbers actually use the same amount of precision digits. IMHO they are merely a different representation of the exact same number.
I know, I can use stripTrailingZeros
and compareTo
instead of equals
, I'm just interested in the reasoning behind this. Can someone maybe help me to understand this?