Fwd: [MLton-user] IEEEReal rounding not working

Matthew Fluet fluet at tti-c.org
Mon Aug 6 15:14:24 PDT 2007


On Mon, 6 Aug 2007, Matthew Fluet wrote:
> On Mon, 6 Aug 2007, Sean McLaughlin wrote:
>>  Thanks again for the fix.  I found another quirk though:
>>  Seems like fromString is going the wrong way for negative numbers.
>>
>>  On 7/29/07, Matthew Fluet <fluet at tti-c.org> wrote:
>> >  I think the Real.{to,from}Decimal are the closest, though the Basis
>> >  Library explicitly states that the conversions occur under TO_NEAREST.
>> >  I believe that the Real.fromString function works according to the 
>> >  current rounding mode.
>
> I would expect that any function which doesn't explicitly state that it 
> occurs under a specific rounding mode would occur under the current rounding 
> mode.  David Gay's binary <-> decimal conversion library (which is what MLton 
> uses) provides functions for string to real that obey the current rounding 
> mode, we were just defaulting to the one that follows the TO_NEAREST mode. 
> Shouldn't be too difficult to use the more general function for the 
> Real.{scan,fromString} conversions.

Using the generalized gdtoa conversion functions, Real.fromString now 
converts according to the current rounding mode.  See
    http://mlton.org/cgi-bin/viewsvn.cgi?rev=5827&view=rev
for more details.



More information about the MLton-user mailing list