[MLton] Re: Hppa

Wesley W. Terpstra terpstra@gkec.tu-darmstadt.de
Wed, 22 Dec 2004 14:58:26 +0100

On Tue, Dec 21, 2004 at 08:06:29PM -0800, Stephen Weeks wrote:
> > #define FLT_MIN 1.17549435e-38
> > I read up on this and this is the smallest unnormalized float: 2^-125.
> Minor quibble: 1.18e-38 is approximately 2^-126.

Err, yeah. =)

> It looks like there's a problem in the MLton basis library
> implementation too.  The regresion test displays reals using Real.fmt
> StringCvt.EXACT.  According to the basis spec, this is equivalent to
> IEEEReal.toString o Real.toDecimal.  The spec for Real.toDecimal says
> that it "should produce only as many digits as are necessary for
> fromDecimal to convert back to the same number".  Since MLton
> implements Real32.toDecimal by converting to a double, it is producing
> too many digits for most floats.  The only fix I see is to change
> runtime/basis/Real/gdtoa.c to make Real32_gdtoa use the gdtoa library
> directly modeled on g_ffmt, just as Real64_gdtoa uses the gdtoa
> library modeled on g_dfmt.  If we're in agreement, I'll do that after
> applying your c99 patch.

Sounds fine to me.

> With that fix, we still may have regression problems with the last
> digit.  If so, I think the right thing is to tweak the regression to
> simply drop the last digit.

If the goal is to make regressions only produce output on actual failure
conditions, then I agree. For a normal application, printing them all would
be the right thing to do.
Wesley W. Terpstra