Haskell Report (again)

Simon Peyton-Jones simonpj@microsoft.com
Fri, 20 Jul 2001 08:35:13 -0700

Dylan (sorry for the wrong name)

| (a) Where's the definition of mk0?  (It was in the text you deleted.)

Ah, it should go back.

| (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?

Sigh.  The numeric library is entirely inadequately documented.
I suppose that now you have forced me to face up to this fact I shall
have to write some (brief) documentation for at least the exported

| (c) I don't think the case e=3D0 is right; you miss the initial "0".

True.  The e>=3D0 should be e>0, I think.

| (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.

Here's a comment I've just deduced and typed in for floatToDigits.
Does it meet the need?

-- floatToDigits takes a base and a non-negative RealFloat number,
-- and returns a list of digits and an exponent.=20
-- In particular, if x>=3D0, and
--	floatToDigits base x =3D ([d1,d2,...,dn], e)
-- then
--	(a) n >=3D 1
--	(b) x =3D 0.d1d2...dn * (base**e)
-- 	(c) 0 <=3D di <=3D base-1