[MLton-devel] Real.fromLargeInt

Matthew Fluet fluet@CS.Cornell.EDU
Wed, 23 Oct 2002 09:26:33 -0400 (EDT)


> Real.fromLargeInt's pos function doesn't seem to be affected by the
> current rounding mode.  Furthermore, ~ (pos (IntInf.~ i)) won't always
> give the correct result for some rounding modes. 

Hmm.  I've got my Basis Library bookmark pointing to the "new" spec which
says:

toInt mode x
toLargeInt mode x
    convert the argument x to an integral type using the specified
rounding mode. Raise Overflow if the result is not representable, in
particular, if x is an infinity. Raise Domain if the input real is a NaN.

fromInt i
fromLargeInt i
    convert integer i to a real value. If the absolute value of i is
larger than maxFinite, then the appropriate infinity is returned. If i
cannot be exactly represented as a real value, then the current rounding
mode is used to determine the resulting value.

The old spec says:

toInt mode x
toLargeInt mode x
    convert the argument x to an integral type using the specified
rounding mode. Raise Overflow if the result is not representable, in
particular, if x is an infinity. Raise Domain if the input real is a NaN.

fromInt i
fromLargeInt i
    convert integers to type real.

So, I guess the behavior is correct for the old spec, but not the new.

Some might argue that it is the responsibility of the maintainer of the
basis-2002 branch to bring the behaviour into accordance with the new
spec.  Others might counter with the argument that because the function
wasn't present when basis-2002 was branched, it is the responsibility of
the author.  ;)



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en

_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel