[m-rev.] for review: fix bug in MR_sprintf_float

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Jul 16 16:31:09 AEST 2010


On Fri, 16 Jul 2010, Ian MacLarty wrote:

> Still bootchecking this, but it passes float_roundtrip and
> test_pretty_print.
>
> runtime/mercury_float.c:
>    Fix a bug in MR_sprintf_float where it would convert 1.8e-10
>    into "1.80000000000000e-1" instead of "1.8e-10".
>
>    The problem was that it was stripping the zeros off the end of the string
>    produced by sprintf without considering the case where the output
>    was in scientific notation.
>
>    The fix is to remove the `#' from the sprintf format string and then to
>    append ".0" to the string if there is no "." or "e".
>
> tests/general/float_roundtrip.m:
> tests/general/float_roundtrip.exp:
>    Add regression test.

That looks fine.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list