From: Patrick Hurley Date: 2006-11-15T06:32:10+09:00 Subject: Re: Is 2.0 Integer or Float? But depending upon how the "integer" was generated, it may still make more sense to use an epsilon in the test (which certainly has the "smell" that was mentioned earlier) Integer(100.0 * 9.95) == 995 => false (100.0 * 9.95) - 995.0 <= Float::EPSILON => true # So you find yourself tempted to do this class Float def like_an_int (self - self.round).abs <= Float::EPSILON end end (100.0 * 9.95).like_an_int => false On my system Float::EPSILON = 2.22044604925031e-016 (100.0 * 9.95) - 995.0 => -1.13686837721616e-013 Which is way bigger than EPSILON, it turns out you need to scale your "EPSILON" by the relative magnitude of the numbers being compared. This way leads to madness and general discomfort --> if you find yourself in this neighborhood, switch to rational numbers (or scaled integers), you will be happier. pth