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

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Nov 26 00:28:02 AEDT 2002


On 25-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> On Sat, Nov 23, 2002 at 04:27:11AM +1100, Fergus Henderson wrote:
> > On 22-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > +% Also while its output must represent the float to sufficient precision, it
> > > +% doesn't need to be in *exactly* the same format as if was formated with
> > > +% "%#.<prec>g".
> > 
> > s/formated/formatted/
> > In what ways is it allowed to differ?
>
> It just must return a string representation of the number with
> sufficient precision to represent the number, any valid format will do.
> I was just trying to make the point that it differs from
> string__float_to_string in that it can be in another format from
> "%#.<prec>g".

Any valid format... hmm.
Is hex OK?

Note that C99 supports hexadecimal notation for floating point constants,
so this is not as silly as it may at first sound ;-)

My point is just that the comment should specify exactly what formats
are allowed.

> For example for 1.0, the following are all valid "1", "1.0",
> "1.000000000000000", "1e0", "0.1e1", "0.10000E1".

That's a start... but a regexp would be a more concise way of specifying it.
(Don't forget Infs and NaNs.)

-- 
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