On Fri, Jul 20, 2001 at 04:59:05AM -0700, Simon Peyton-Jones wrote:
Dale is absolutely right! How has this entirely bogus code survived so long?
Err, my name is Dylan...
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.
(a) Where's the definition of mk0? (It was in the text you deleted.) (b) What is the code supposed to do? The code you posted always prints a decimal point; I imagine this is intended? Can this be documented? (c) I don't think the case e=0 is right; you miss the initial "0". (d) "floatToDigits" seems to return an exponent that is off by 1 from what I expected at first. This is reasonable, but since the function is exported, it should be documented. Best, Dylan
================ Library Report, Numeric library, Section 4.1, page 13. In the definition of formatRealFloat, 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 >= 0 -> take e (ds ++ repeat '0') ++ "." ++ mk0 (drop e ds) | otherwise -> "0." ++ replicate (-e) '0' ++ ds
===========================