0

ruby. add. 0.1+0.2 ?

puts 0.1+0.2 # out 0.30000000000000004 why?!

25th Dec 2016, 10:23 AM
Денис Ананьев
Денис Ананьев - avatar
1 Antwort
0
Ok. I found it http://0.30000000000000004.com/ puts (0.1+0.2).round(2) # 0.3
25th Dec 2016, 10:53 AM
Денис Ананьев
Денис Ананьев - avatar