From: The Higgs bozo Date: 2008-10-28T02:10:25+09:00 Subject: Re: float equality guille lists wrote: > I'm a bit lost here, shouldn't (0.1) and (1 - 0.9) be equals regarding > the == operator? Nope. Floating-point is always inexact. This is a computer thing, not a Ruby thing. The issue applies to all languages everywhere which use floating point. Here you can see the two values are slightly different: irb(main):001:0> 1 - 0.9 == 0.1 => false irb(main):002:0> [1 - 0.9].pack("D") => "\230\231\231\231\231\231\271?" irb(main):003:0> [0.1].pack("D") => "\232\231\231\231\231\231\271?" -- Posted via http://www.ruby-forum.com/.