readFloat
Ch. A. Herrmann
herrmann@fmi.uni-passau.de
Fri, 31 May 2002 19:23:45 +0200
Hi Haskellers,
>>>>> "Max" == Max Kirillov <max630@mail.ru> writes:
Max> So why one might need it? I've never used Rational, but, if
Max> asked, I would say that they are for exact representation of
Max> numbers (some symbolic calcs).
that's true. I'm using rationals intensively since a couple of years for this
purpose and I'd like that they remain as exact as they are.
Max> On the other side, 'real' dotted
Max> numbers always represent some real values with finite
Max> accuracy.
I'm not sure if that always is the case, but there is the danger of
confusion and this should be enough reason to be careful.
Max> That's look like a bad idea to me to call Rational
Max> numbers 'real' and type (print) them as a decimal fraction (*).
Especially converting rationals to a string and back should always
be the identity. It would be better to print rationals in the
form
numerator % denominator
and read them in the same form.
Surely, it's good to have flexibility in a programming language;
but at critical points --and conversions between floating points
(even if represented as strings) and rationals are such a point--
a programming language should demand explicit conversion.
Cheers
--
Christoph