In my Java class. My teacher has asked this question. Can anyone help me out, I would appreciate it. TY.
why
0.3+0.3+0.3 = 0.899999999999999
in java ?????
In my Java class. My teacher has asked this question. Can anyone help me out, I would appreciate it. TY.
why
0.3+0.3+0.3 = 0.899999999999999
in java ?????
Its because of floating point precision errors. The reason is that these data types are built for fast and accurate approximations and not for exact results. For that we use BigDecimal
For more info Java Types Java Float Types