From: Brian Candler Date: 2008-12-21T01:03:05+09:00 Subject: Re: about Float You're right, it works if you explicitly promote some of the constants to BigDecimal: class Numeric def bd BigDecimal.new(to_s,100) end end def f(x,y) (333.75.bd-x**2)* y**6 + x**2 * (11 * x**2 * y**2-121 * y**4 - 2) + 5.5.bd * y**8 + x/(2*y) end puts f(77617.bd,33096.bd) I didn't change any parentheses, just added .bd at certain places. The trouble seems to be: mixing BigDecimal and Integer works fine (promotes to BigDecimal), but mixing BigDecimal with Float downgrades to Float. irb(main):007:0> BigDecimal.new("7",100) + 2 => # irb(main):008:0> 2 + BigDecimal.new("7",100) => # irb(main):009:0> BigDecimal.new("7",100) + 2.0 => 9.0 irb(main):010:0> (BigDecimal.new("7",100) + 2.0).class => Float So you have to be careful not to mix any Float constants in. -- Posted via http://www.ruby-forum.com/.