Haskell Report (again)
Fri, 20 Jul 2001 04:59:05 -0700
Dale is absolutely right! How has this entirely bogus code survived so
Here is an (alleged) fix, which works in the tests I've tried. If
else can spare a moment to check my code I'd be very grateful.
This is definitely going in the Revised H98 report!
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
| -----Original Message-----
| From: Dylan Thurston [mailto:firstname.lastname@example.org]=20
| Sent: 17 July 2001 07:33
| To: Simon Peyton-Jones
| Cc: email@example.com
| Subject: Re: Haskell Report (again)
| On Tue, Jul 10, 2001 at 05:50:08AM -0700, Simon Peyton-Jones wrote:
| > As ever, the draft is at
| > http://research.microsoft.com/~simonpj/haskell98-revised
| > I'm really hoping this is the final version, but experience=20
| > that whenever I say that someone discovers an entirely new=20
| > So I'm putting it out again for you to pick over.
| 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:
| showFFloat Nothing 0.02 ""
| goes into an infinite loop. (There is an auxiliary function
| 'f n s ds' which does not consider the case n < 0).
| This suggests that there needs to be a code review of=20
| formatRealFloat, which I have not yet done.
| --Dylan Thurston