From: Adam Prescott Date: 2012-01-22T11:24:45+09:00 Subject: Re: Microrant on Ruy's Math Skills --14dae9399ac1e6cfdb04b7149ded Content-Type: text/plain; charset=UTF-8 On Sun, Jan 22, 2012 at 02:08, Intransition wrote: > Yea, I just don't expect Ruby's first priority to be speed. I tend to > expect POLS, which I would think would lead to giving priority to precision > (which I suppose means BigDecimal) but allow the option for faster floating > point if needed. > Since you mentioned POLS, the standard thing to remember is that it's Matz's surprise, once you understand Matz's view of things. :) Aside from that, though, if you understand that 0.9 is a floating point number, and you're coming from other languages where this is the case, then you understand what it means to compare 0.9 to another number which displays as 0.9. "%.60f" % 0.9 #=> "0.900000000000000022204460492503130808472633361816406250000000" But I also recognise that it will throw people completely new to programming who have no appreciation for what's happening beneath various levels of abstraction created by the language when the issue arises. Also, this is probably obligatory: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html (I'm surprised it hasn't been mentioned yet!) (For the POLS thing in Ruby: https://en.wikipedia.org/wiki/Ruby_(programming_language)#Philosophy ) --14dae9399ac1e6cfdb04b7149ded--