0.1+0.2 = 0.3 ? what happen ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

0.1+0.2 = 0.3 ? what happen ?

i try 0.1 + 0.2 but answer is 0.30000000000000004

8th May 2017, 11:01 AM
Thiwanon Chomcharoen
Thiwanon Chomcharoen - avatar
3 Answers
+ 1
That's why you should use BigDecimal instead float or double when you work with currency.
8th May 2017, 11:08 AM
Szabó Gábor
Szabó Gábor - avatar
+ 1
The first tag is Java 😊
8th May 2017, 11:42 AM
Szabó Gábor
Szabó Gábor - avatar