summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2000-04-18 14:41:13 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2000-04-18 14:41:13 +0000
commitc84b743445fcf237a436c00f6e5c700b1499f8e1 (patch)
treece9233ea788fd687d16b04ddc70dd00df7e610df
parentd56d25aaf26283394f02f2da8072a69d164fd7c5 (diff)
Ajout _to_float, _of_float
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3106 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--byterun/ints.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/byterun/ints.c b/byterun/ints.c
index 00d354e08..687662081 100644
--- a/byterun/ints.c
+++ b/byterun/ints.c
@@ -223,6 +223,12 @@ value int32_of_int(value v) /* ML */
value int32_to_int(value v) /* ML */
{ return Val_long(Int32_val(v)); }
+value int32_of_float(value v) /* ML */
+{ return copy_int32((int32)(Double_val(v))); }
+
+value int32_to_float(value v) /* ML */
+{ return copy_double((double)(Int32_val(v))); }
+
value int32_format(value fmt, value arg) /* ML */
{
char format_string[32], default_format_buffer[32];
@@ -355,6 +361,12 @@ value int64_of_int(value v) /* ML */
value int64_to_int(value v) /* ML */
{ return Val_long((long) Int64_val(v)); }
+value int64_of_float(value v) /* ML */
+{ return copy_int64((int64)(Double_val(v))); }
+
+value int64_to_float(value v) /* ML */
+{ return copy_double((double)(Int64_val(v))); }
+
value int64_of_int32(value v) /* ML */
{ return copy_int64(Int32_val(v)); }
@@ -451,6 +463,12 @@ value int64_of_int(value v)
value int64_to_int(value v)
{ invalid_argument(int64_error); }
+value int64_of_float(value v)
+{ invalid_argument(int64_error); }
+
+value int64_to_float(value v)
+{ invalid_argument(int64_error); }
+
value int64_of_int32(value v)
{ invalid_argument(int64_error); }
@@ -590,6 +608,12 @@ value nativeint_of_int(value v) /* ML */
value nativeint_to_int(value v) /* ML */
{ return Val_long(Nativeint_val(v)); }
+value nativeint_of_float(value v) /* ML */
+{ return copy_nativeint((long)(Double_val(v))); }
+
+value nativeint_to_float(value v) /* ML */
+{ return copy_double((double)(Nativeint_val(v))); }
+
value nativeint_of_int32(value v) /* ML */
{ return copy_nativeint(Int32_val(v)); }