[MLton-devel] cvs commit: Real and IEEEReal improvements

Stephen Weeks MLton@mlton.org
Mon, 2 Jun 2003 12:06:56 -0700


> >   1. In MLton Real.scan stops after "inf" since scan is looking for a
> >   prefix.  There is no need to ever look for "infinity".
> 
> But shouldn't scan accept the longest prefix that matches the regexp for a
> real number?  Then it should take the whole word.

Makes sense.  I'll change it.

> >   3. For Real.fmt GEN, are reals required to have at least one digit
> >   after the decimal point?  MLton says no.
> 
> What's the rationale for no digit's after the decimal point?  We seem to
> be different from all the other implementations in this respect.

The rationale is based on the following part of the spec

	Adaptive notation: the notation used is either scientific or
	fixed-point depending on the value converted 

Since FIX can display reals without a decimal point (and all the
implementations do this with FIX (SOME 0)), it seems to me that GEN
should do so when it can.  Also, the idea of GEN (SOME n) is that n
specifies the maximum number of significant digits.  So, it is
incorrect to display 13.0 for GEN (SOME 2), since 13.0 has three
significant digits.

> >   4. For Real.fmt, are exponents required to be at least two digits?
> >   The documentation reads as if there are exactly two, but that can't be
> >   right, since reals can be larger than 9E99.  I've noticed that
> >   implementations differ on whether to add a leading 0 on exponents.  I
> >   decided in MLton to never add it.
> 
> Another interpretation of the spec is that Real.fmt SCI specifies the
> number of digits to appear after the decimal point not, independent of the
> number of digits appearing in the exponent.  (I don't think you would read
> the spec as requiring Real.fmt FIX to have 3 digits appearing before the
> decimal point.)  I agree that the exponent shouldn't have leading 0s.

I am confused.  Are you saying agree that SCI specifies the number of
digits after the decimal point including the exponent (your "not" is
confusing me)?  I.E.
	fmt (SCI (SOME 3)) 1.2 = "1.20E0"
No that can't be what you mean.  I'm confused.

I was referring to the part of the documentation that said

	Scientific notation: [~]d.dddE[~]dd, 

I think it is likely a typo in the spec that the "dd" after the "E[~]"
is in a different font than the other "d.ddd", which makes me read it
less like a variable number of digits.

So, I'm not taking any action on this point, unless someone can
unconfuse me.



-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel