From: Kero van Gelder Date: 2001-07-30T05:40:09+09:00 Subject: [ruby-talk:18757] Re: Numbers classes.. Rational number? [was: Ruby as opposed to Python?] > > 12345678901234567890 / 1.0 => 1.23456789e+19 > > > > which actually looses accuracy, by automatically converting to float, > > instead of BigNum. This would be an argument to drop automatic > > conversion for floats. You could still convert automatically with > > Numerics and Rationals, since you loose nothing (and should expect a > > Rational anyway). > > Of course, the number 1.0 is imprecise so you don't loose accuracy. What > you seem to propose is rather than to convert '12345678901234567890' > to a float is to convert '1.0' to a Fixnum or Bignum, making the result > look more accurate than it really is (The 1.0 could of course be the > result of some float, i.e. inaccurate, computation). No, I argued against any automatic conversion at all. But that is inconvenient, so matz will never do that. You are right about the 1.0 having no accuracy when it is a result; I suggested it as clear-cut one, where the Biggie was a result. Hm.. Not good :( > In my opinion Rational results should be an option rather > than glued into the language, as many computations involve irrational > numbers, too. My iPAQ has no FPU, but I can not choose not to incorporate floats into Ruby :) Point taken and agreed to. As I understood in this thread, rationals are already in the default extensions: require 'rational' +--- Kero ------------------------------ kero@chello.nl ---+ | Don't split your mentality without thinking twice | | Proud like a God -- Guano Apes | +--- M38c ------- http://members.chello.nl/~k.vangelder ---+