Introducing the (compiler private) helper function to turn out a

string representation of a floating point number to a valid Caml token
(valid_float_token).


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5116 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Pierre Weis 2002-09-05 10:31:18 +00:00
parent 0d986a420a
commit c89dbcc9e0
2 changed files with 5 additions and 2 deletions

View File

@ -185,8 +185,7 @@ module String = struct
external get : string -> int -> char = "%string_safe_get"
end
let string_of_float f =
let s = format_float "%.12g" f in
let valid_float_lexem s =
let l = string_length s in
let rec loop i =
if i >= l then s ^ "." else
@ -196,6 +195,8 @@ let string_of_float f =
loop 0
;;
let string_of_float f = valid_float_lexem (format_float "%.12g" f);;
external float_of_string : string -> float = "float_of_string"
(* List operations -- more in module List *)

View File

@ -802,6 +802,8 @@ val at_exit : (unit -> unit) -> unit
(** {6 For system use only, not for the casual user} *)
val valid_float_lexem : string -> string
val unsafe_really_input : in_channel -> string -> int -> int -> unit
val do_at_exit : unit -> unit