Christopher Dicely wrote:
> On Wed, Oct 28, 2009 at 12:30 PM, Marnen Laibow-Koser 
> <marnen / marnen.org> wrote:
>>
>>> work with real numbers but just rational numbers.
>>
>> That is not the issue here -- after all, BigDecimal does precise
>> arithmetic, but only with rational numbers.
> 
> BigDecimal actually works with decimal numbers, which are a subset of
> rational numbers; Rational does precise math with rational numbers.
> 

You're quite right, and I realized that about 10 seconds after I posted. 
:)

>>??The issue is rather that IEEE 754 does an inadequate job of representing
>> arbitrary rational numbers, and the small errors are accumulated and
>> magnified in calculations.
> 
> The bigger issue is that Ruby -- like most general purpose programming
> languages, though there are exceptions like Scheme -- makes IEEE 754
> floating point the easiest non-integer data type to use, rather than
> using exact numbers by default and using inexact numbers only when
> explicitly called for (or when an operation that produces inexact
> results is used.)

Yup.  At least Ruby took a step in the right direction by making Bignum 
transparent; it would be lovely if some future version did likewise with 
BigDecimal.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org
-- 
Posted via http://www.ruby-forum.com/.