diff: sp_lib.nl string / float conversions

Fergus Henderson fjh at cs.mu.oz.au
Wed Jul 23 21:07:07 AEST 1997


library/sp_lib.nl:
	Add SICStus versions of string__float_to_string
	and string__float_to_f_string.

Index: sp_lib.nl
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/sp_lib.nl,v
retrieving revision 1.22
diff -u -r1.22 sp_lib.nl
--- sp_lib.nl	1997/05/06 17:09:54	1.22
+++ sp_lib.nl	1997/07/23 11:06:35
@@ -97,6 +97,17 @@
 string__to_float(String, Float) :-
 	number_chars(Float, String).
 
+string__float_to_string(Float, String) :-
+	number_chars(Float, String).
+
+	% This implementation of string__float_to_f_string is not
+	% 100% correct, because it will do the wrong thing
+	% for large numbers (print them in 1.0E+10 notation,
+	% rather than as 1000000000.0).  But this is good
+	% enough for the moment, I think.
+string__float_to_f_string(Float, String) :-
+	number_chars(Float, String).
+
 duplicate(Term, Copy) :-
 	copy_term(Term, Copy).
 
-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list