From: Alex Chaffee Date: 2012-01-27T05:54:32+09:00 Subject: Re: Microrant on Ruy's Math Skills (1) I love this thread! Though every time I open it, I think some poor guy named Ruy needs a math tutor... (2) The amount of emotion and defensiveness around this issue is staggering. It is the very definition of a religious argument. On one side are people who think "math should work like I learned in grade school," on the other are people who think "math does work like I learned in college" (and the subset of those saying, "if you haven't had my level of training then you are stupid"), and then there a bunch of people in the middle saying, "you're both right, sort of!" (3) I spend a lot of time teaching people programming, not writing statistical algorithms, and I've written a unit testing library that aims to be as unobtrusive as possible, so my main concern is to minimize surprise while not undermining correctness. So naming my method "close_to?" allows me to dodge the religious question "what is equality?" and focus on getting noobies to understand just enough complicated math to get their tests to pass, which basically amounts to the lesson "floats are weird sometimes". I do think it's important that Ruby Float == keeps working exactly like C == and JavaScript == (kinda) and Python == though. Or, what Yossef and Gavin said: "there are two different concerns at play here. One is the standard problem with IEEE floating-point representation. The other is deciding whether one number is "close enough" to another. One of these could be the concern of a programming language, while the other would be the concern of a particular program." (4) Gavin, I *did* follow your message to the end, and the code helped me really get your point. I also like Whitestone (I mean, "I Lk W") and I might steal some of your comparators. Allow me to return the favor by teaching you that Github supports line numbers in its URLs, e.g. https://github.com/gsinclair/whitestone/blob/master/lib/whitestone/assertion_classes.rb#L275-282 (5) How tragic is it that C broke a mathematical notation that had worked just fine for hundreds of years and chose to define "=" as assignment instead of equality? Amirite? Who's with me? :-) -- Alex Chaffee - alex@stinky.com http://alexchaffee.com http://twitter.com/alexch