[m-rev.] for review: mercury implementation of float_to_string

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 27 18:18:17 AEDT 2002


On 26-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> fjh wrote:
> > On 25-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > @@ -96,9 +96,13 @@
> > >  :- pred string__float_to_string(float, string).
> > >  :- mode string__float_to_string(in, uo) is det.
> > >  % Convert an float to a string.
> > > -% The resulting float will be in the form that it was printed using
> > > -% the format string "%#.<prec>g" where <prec> is the required precision
> > > -% needed to represent the string.
> > > +% In the current implementation the resulting float will be in the
> > > +% form that it was printed using the format string "%#.<prec>g" where
> > > +% <prec> is in the range p to (p+2) where
> > > +% p = floor(mantissa_digits * log2(base_radix) / log2(10)) and
> > > +% the precision is sufficient to allow a successful decimal -> binary
> > > +% conversion of the float.
>
> If I didn't have a cold, no problem, big lungs ;)

Oh yeah.  I'll believe it when I hear it ;-)

> In the current implementation the resulting float will be in the
> form that it was printed using the format string "%#.<prec>g".
> <prec> will be in the range p to (p+2) where
> p = floor(mantissa_digits * log2(base_radix) / log2(10)).
> The precision chosen from this range will be such to allow a
> successful decimal -> binary conversion of the float.

That's much better -- thanks!

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list