Well, I’m living in 2005. New languages are born daily, and most of them insist in some of the same mistakes. 3/2 is not equal to 1, but 3/2. I think I learned that in first grade.
Ok, there’s a long and heated argument behind all that, but hey, I started programming exactly because I wanted an easy way out of dull math homework like what we get on the first grade, and computers could do calculations so much better and faster than me when I was 8 (and they still can, last time I checked). But back in the QBasic days, I couldn’t teach the damn computer to figure out the fractions for me, and there was no answer labelled “0.444…” on those tests. So, as you can see, this topic brings back the memories of the first few times I became really frustrated at a computer, something that happens every couple of minutes nowadays. And Ruby just relieved some of that pain:
Well, so far, it’s still frustrating. Behold, the great
irb(main):003:0> require 'mathn'
irb(main):006:0> 3/2 - 2/2
Rather odd to see the way basic math works differently after requiring a so innocent-looking module, especially for those used to static languages, but there’s a lot of power and flexibility behind that. I do like power and flexibility, if simplicity comes in the package, and in this case, it does.