[m-dev.] diff: fix precision bug in string__format

Peter Ross peter.ross at miscrit.be
Fri Aug 11 02:33:55 AEST 2000


Hi,


===================================================================


Estimated hours taken: 0.5

library/string.m:
    Fix a bug where "%.f" wasn't parsed as a valid format string.  If no
    number follows the '.' the precision should default to 0, which is
    what is now done.


Index: string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.125
diff -u -r1.125 string.m
--- string.m	2000/08/10 09:01:15	1.125
+++ string.m	2000/08/10 16:30:44
@@ -1041,9 +1041,14 @@
 		=(Init),
 		digit,
 		zero_or_more_occurences(digit),
-		=(Final),
-
+		=(Final)
+	->
 		{ list__remove_suffix(Init, Final, Prec) },
+		{ PolyTypes = PolyTypes0 }
+	;
+			% When no number follows the '.' the precision
+			% defaults to 0.
+		{ Prec = ['0'] },
 		{ PolyTypes = PolyTypes0 }
 	).
 

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list