[MLton] real hash table

Henry Cejtin henry.cejtin@sbcglobal.net
Mon, 29 May 2006 16:31:47 -0500


I have to make a hash table of real values.  For the hash function, it looks
like the best way is to use PackRealBig and to then compute a hash on the
Word8Vector.  The problem is that I need to make sure that the real is in
64-bit mode so that the Real.== comparisons work in the way that I want them
to.  (Forget, for the moment, about Nan's.)  This seems like a general problem
where you compute something and now you want that something in its 64-bit
form, not in any extended 80-bit form.  What is the fastest way to do that
conversion from within MLton?

I could store it into a real ref, then pass it to some no-op C function and
fetch the result, but calling C functions from MLton is not super fast.
Is there any better alternative?