[MLton] Re: [MLton-commit] r5662

Vesa Karvonen vesa.a.j.k at gmail.com
Thu Jun 21 11:45:11 PDT 2007


On 6/21/07, Stephen Weeks <sweeks at sweeks.com> wrote:
> > + * Currently, the equality of reals is the same as the {LargeReal.==}
> > + * function.  This differs disturbingly from the equality for other types.
> > + * In particular, {~0.0} and {0.0} are considered equal even though they
> > + * are different values and {nan} is not considered equal to any value,
> > + * including itself.  This is problematic for a number of important
> > + * non-numerical applications such as serialization.
>
> I wonder if it would be so bad to use bitwise equality for reals.

I'd like to use bitwise equality in this particular case.  (I wouldn't
overload = for reals with bitwise equality.)  Unfortunately, SML/NJ,
which I'd also like to support, doesn't currently seem to provide
PackReal* structures, and I'd hate to have to use FFI (or just the
mlnlffi lib) for this. Actually, this isn't the only place where lack
of PackReal* structures is hurting.  So, I'll probably have to do
something about it anyway (use mlnlffi lib or implement the PackReal*
structures for SML/NJ).

Ideally I'd like to have a Word structure corresponding to each Real
structurewith enough bits to hold the corresponding real, and
conversions from real to word and back.  Packing a real to a byte
array kills performance on modern CPUs.

-Vesa Karvonen



More information about the MLton mailing list