Yes, this is floating point error. The problem is that the literals 0.333333333
and 0.666666666
are represented as doubles before being passed as an argument to BigDecimal
--- notably, BigDecimal
's constructor takes a double
as an argument.
This is supported by the standard, which says that floating point literals default to double unless otherwise specified.