[clean-list] Exercise 2 from Chapter 2 of Clean Book
fzuurbie@inter.nl.net
fzuurbie@inter.nl.net
Thu, 20 Nov 2003 07:49:56 UT
This is a multi-part message in MIME format.
--_----------=_1069314596113804
Content-Disposition: inline
Content-Length: 658
Content-Transfer-Encoding: binary
Content-Type: text/plain
> Howdy,
>
> The problem is...
>
> Finite precision of reals. Execute the start expression given
> in section 2.4.2. Rewrite the program such that it only prints
> the smallest number that is different from zero using the
> function until.
>
> The program we must rewrite is...
>
> Start = takeWhile ((<>) 0.0) (iterate (\x -> x/10.0) 1.0)
[...]
> Can anyone help me with this?
>
Yes: never use == (or <> for that matter) on Reals
The Nijmegen team should consider removing the == instance for Reals
For now: skip the exercise, it should never have been in the book in the first place.
Regards Erik Zuurbier
--_----------=_1069314596113804--