Am I mistaken in saying that this is due to a double inaccuracy?
You are absolutely right, this is precisely because of double inaccuracies.
But since this is BigDecimal , should it not be the same?
No, it should not. The error has been introduced since the creation of new BigDecimal(0.333333333) , because the constant 0.333333333 already has an error built into it. At this moment, you canβt fix anything to correct this misconception: the proverbial horse was coming out of the barn by that time, so itβs too late to close the doors.
When you pass String , on the other hand, the decimal representation exactly matches the string, so you get a different result.
source share