From: "Peña, Botp" Date: 2007-06-22T12:03:28+09:00 Subject: Re: Ruby doesn't know how to multiply From: Michael W. Ryder [mailto:_mwryder@worldnet.att.net] : # My simple calculator is more precise for some math operations than my # expensive PC. Maybe we need to implement something like # General Decimal # Arithmetic which is available for C++ and Java at # http://www2.hursley.ibm.com/decimal/ in Ruby. It may be as simple as # writing wrappers for the operations, I haven't had to time to look # closer at the package. have you tried bigdecimal? irb(main):001:0> require 'bigdecimal' => true irb(main):002:0> a=BigDecimal("14.95") => # irb(main):003:0> b=BigDecimal("0.6") => # irb(main):004:0> c=BigDecimal("8.97") => # irb(main):005:0> d=BigDecimal("8.970000001") => # irb(main):006:0> a*b == c => true irb(main):007:0> a*b == d => false irb(main):008:0> c == 8.97 => true bigdecimal notation is very handy for calculator-like applications since the raw input usually is of type string. kind regards -botp