vendredi 8 mai 2015

Why in ruby, 0.692 * 3 = 2.0759999999999996?

$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]

$ irb
irb(main):001:0> 0.692 * 3
=> 2.0759999999999996

I just ran into these numbers by chance. Is this related to Why Are Floating Point Numbers Inaccurate?.

Aucun commentaire:

Enregistrer un commentaire