[rspec-users] any tricks re using " eql(5.5)", but where 5.5 is a decimal not float?

Ashley Moran ashley.moran at patchspace.co.uk
Mon Nov 10 06:10:17 EST 2008


On Nov 10, 2008, at 12:21 am, Greg Hauptmann wrote:

> Ashley - what's you're recommendation re using BigDecimal (which does
> work as you point out) and the Money gem (which it sounds like makes a
> dev's life a bit easier)???  Is it worth trying to port an application
> from use of BigDecimal to Money gem???


Hi Greg

I'd use the money gem if and only if it's underlying implementation is  
BigDecimal or some other fixed-precision system.  I've had a look over  
it and it appears to use integers to store values as small as 1/100 of  
the base unit.  So as long as you don't need to use anything smaller  
than that in calculations (ie, you only add, and never multiply,  
values - eg for tax calculations) it will be fine.

I'll try not to say too much more, we're straying well away from RSpec  
territory...

Ashley

-- 
http://www.patchspace.co.uk/
http://aviewfromafar.net/



More information about the rspec-users mailing list