summaryrefslogtreecommitdiff
path: root/stdlib/pervasives.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2001-02-05 08:55:25 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2001-02-05 08:55:25 +0000
commitadc10efa0c3b9e3c9cd2d42bbf6e841720f8fd05 (patch)
tree46503cafa5e037463107b4673749727158643e1d /stdlib/pervasives.ml
parent918275b5742a85f59e9ddef55c88acaa31fda377 (diff)
downloadocaml-adc10efa0c3b9e3c9cd2d42bbf6e841720f8fd05.tar.gz
Documentation amelioree. Ajout de infinity, neg_infinity, nan, classify_float
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3392 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/pervasives.ml')
-rw-r--r--stdlib/pervasives.ml17
1 files changed, 17 insertions, 0 deletions
diff --git a/stdlib/pervasives.ml b/stdlib/pervasives.ml
index 20412d4212..b572efeba6 100644
--- a/stdlib/pervasives.ml
+++ b/stdlib/pervasives.ml
@@ -106,6 +106,23 @@ external float : int -> float = "%floatofint"
external float_of_int : int -> float = "%floatofint"
external truncate : float -> int = "%intoffloat"
external int_of_float : float -> int = "%intoffloat"
+external float_of_bytes : string -> float = "float_of_bytes"
+let infinity =
+ float_of_bytes "\127\240\000\000\000\000\000\000"
+ (* 0x7F F0 00 00 00 00 00 00 *)
+let neg_infinity =
+ float_of_bytes "\255\240\000\000\000\000\000\000"
+ (* 0xFF F0 00 00 00 00 00 00 *)
+let nan =
+ float_of_bytes "\127\240\000\000\000\000\000\001"
+ (* 0x7F F0 00 00 00 00 00 01 *)
+type fpclass =
+ FP_normal
+ | FP_subnormal
+ | FP_zero
+ | FP_infinite
+ | FP_nan
+external classify_float: float -> fpclass = "classify_float"
(* String operations -- more in module String *)