Haskell Report (again)

Simon Peyton-Jones simonpj@microsoft.com
Fri, 20 Jul 2001 04:59:05 -0700


Dale is absolutely right!  How has this entirely bogus code survived so
long?

Here is an (alleged) fix, which works in the tests I've tried.  If
anyone
else can spare a moment to check my code I'd be very grateful.

This is definitely going in the Revised H98 report!

Thanks Dale.

Simon

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Library Report, Numeric library, Section 4.1, page 13.
  In the definition of formatRealFloat,=20
  in the definition of doFmt,
  in the FFFixed branch of "case fmt of ...",
  in the Nothing branch of "case  decs of ..."
  replace the entire branch "Nothing -> ..." with

       Nothing | e >=3D 0    -> take e (ds ++ repeat '0') ++ "." ++ mk0
(drop e ds)
	         | otherwise -> "0." ++ replicate (-e) '0' ++ ds

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D


| -----Original Message-----
| From: Dylan Thurston [mailto:dpt@math.harvard.edu]=20
| Sent: 17 July 2001 07:33
| To: Simon Peyton-Jones
| Cc: haskell@haskell.org
| Subject: Re: Haskell Report (again)
|=20
|=20
| On Tue, Jul 10, 2001 at 05:50:08AM -0700, Simon Peyton-Jones wrote:
| > As ever, the draft is at
| >=20
| > 	http://research.microsoft.com/~simonpj/haskell98-revised
| >=20
| > I'm really hoping this is the final version, but experience=20
| suggests=20
| > that whenever I say that someone discovers an entirely new=20
| question!=20
| > So I'm putting it out again for you to pick over.
|=20
| I'm astonished no one has noticed this before, but in the=20
| library report for the Numeric library, the definition of=20
| showFFloat is buggy:
|=20
| showFFloat Nothing 0.02 ""
|=20
| goes into an infinite loop.  (There is an auxiliary function
| 'f n s ds' which does not consider the case n < 0).
|=20
| This suggests that there needs to be a code review of=20
| formatRealFloat, which I have not yet done.
|=20
| --Dylan Thurston
|=20