[m-rev.] for review: overflow in string-to-float conversions
Paul Bone
paul at bone.id.au
Mon Dec 22 13:24:36 AEDT 2014
On Mon, Dec 22, 2014 at 12:36:40PM +1100, Julien Fischer wrote:
>
> For review by anyone.
>
> diff --git a/library/string.m b/library/string.m
> index ed8b7ce..d41147e 100644
> --- a/library/string.m
> +++ b/library/string.m
> @@ -1098,13 +1098,15 @@
> %
> :- func det_base_string_to_int(int, string) = int.
>
> - % Convert a string to a float. If the string is not a syntactically
> - % correct float literal, to_float fails.
> + % Convert a string to a float, returning infinity or -infinity if the
> + % conversion overflows. Fails if the string is not a syntactically correct
> + % float literal.
> %
> :- pred to_float(string::in, float::out) is semidet.
>
> - % Convert a string to a float. Throws an exception if the string is not
> - % a syntactically correct float literal.
> + % Convert a string to a float, returning infinity or -infinity if the
> + % conversion overflows. Fails if the string is not a syntactically correct
> + % float literal.
> %
> :- func det_to_float(string) = float.
>
You have a copy-pasted error. This does not fail, it is det.
Otherwise the diff is fine.
--
Paul Bone
More information about the reviews
mailing list