From: Marnen Laibow-Koser Date: 2009-11-15T10:41:15+09:00 Subject: Re: Trajectories Eleanor McHugh wrote: > On 15 Nov 2009, at 01:19, Marnen Laibow-Koser wrote: >> >> IEEE floats have no advantages that I can see and huge >> disadvantages. I >> just don't see them as being even slightly appropriate or useful for >> math. > > Because often expressing non-integral values as floating-point in code > better represents intent than using fixed-point math, True, perhaps. Ward was doing fixed-point currency, so expressing amounts as pennies is semantically clear. But that's where BigDecimal comes in. It's clearly a floating-point number, but it's actually accurate. Semantically clear, numerically precise. What more could you want? :) > and unless the > latter will have a performance or accuracy advantage for a given > problem I consider semantic simplicity to be my primary design > criterion. BigDecimal is no less semantically simple than Float (particularly when coupled with Ruby's operator overloading), and it will always have an accuracy advantage for any conceivable problem. > > That said I agree that floating-point sucks and that many programmers > use it in a carefree manner that suggests they're unaware of the > limitations it imposes. > > > Ellie > Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.