Ajout des fonctions int_of_float, float_of_int et bool_of_string.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2209 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Pierre Weis 1998-12-02 10:39:36 +00:00
parent ec7e60cf1b
commit d0abd87e0b
2 changed files with 8 additions and 2 deletions

View File

@ -5,7 +5,7 @@
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 1996 Institut National de Recherche en Informatique et *)
(* Automatique. Distributed only by permission. *)
(* en Automatique. Distributed only by permission. *)
(* *)
(***********************************************************************)
@ -107,7 +107,9 @@ external frexp : float -> float * int = "frexp_float"
external ldexp : float -> int -> float = "ldexp_float"
external modf : float -> float * float = "modf_float" "modf"
external float : int -> float = "%floatofint"
external float_of_int : int -> float = "%floatofint"
external truncate : float -> int = "%intoffloat"
external int_of_float : float -> int = "%intoffloat"
(* String operations -- more in module String *)
@ -135,6 +137,10 @@ external format_float: string -> float -> string = "format_float"
let string_of_bool b =
if b then "true" else "false"
let bool_of_string = function
| "true" -> true
| "false" -> false
| _ -> invalid_arg "string_of_bool"
let string_of_int n =
format_int "%d" n

View File

@ -178,6 +178,6 @@ let establish_server server_fun sockaddr =
close_in inchan;
close_out outchan;
exit 0
| id -> close s; waitpid [] id (* Reclaim the son *); ()
| id -> close s; let _ = waitpid [] id (* Reclaim the son *) in ()
done