On Mon, 24 Aug 2009 10:56:00 -0700, you wrote: >This will work (I'll go update the code now) but it still leaves the >problem I mentioned that if you are unfamiliar with the vagaries of >floating point math -- or even if you momentarily forget -- then using >== will occasionally mysteriously fail. So my proposal remains: can >the == matcher do be_close(x, 0.0000000001) for floats? Arguments pro >and con?
If you are unfamiliar with the vagaries of floating-point math, then you need to get familiar, or else avoid using floating-point math. The world is already littered with software that doesn't work properly because the programmers didn't understand floating-point math. Perpetuating that kind of ignorance will not make the world a better place. Floating-point math is _inherently_ inexact. Back in my programmer support days, I used to have a standing bet, which I will reiterate now: Show me a technique that you claim "fixes" an inexactness problem with floating-point math. I bet you US$100 that I can supply a trivial example that breaks your fix. -Steve _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users