[m-rev.] diff: java implementation of float_to_string

Peter Wang novalazy at gmail.com
Fri Jul 10 15:00:32 AEST 2009


Branches: main

library/string.m:
        Add Java foreign_proc implementation of string.float_to_string.

diff --git a/library/string.m b/library/string.m
index f23329e..6d63b87 100644
--- a/library/string.m
+++ b/library/string.m
@@ -3342,6 +3342,16 @@ string.from_float(Flt) = string.float_to_string(Flt).
     MR_float_to_string(Flt, Str);
 }").

+:- pragma foreign_proc("Java",
+    string.float_to_string(Flt::in, Str::uo),
+    [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
+        does_not_affect_liveness, no_sharing],
+"
+    Str = java.lang.Double.toString(Flt);
+").
+
+% XXX This implementation has problems when the mantissa cannot fit in an int.
+
 string.float_to_string(Float, unsafe_promise_unique(String)) :-
     % XXX The unsafe_promise_unique is needed because in
     % string.float_to_string_2 the call to string.to_float doesn't
--------------------------------------------------------------------------
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