]> CRI, Mines Paris - PSL - Faustine.git/blobdiff - interpretor/aux.ml
Revert "Examples Makefile."
[Faustine.git] / interpretor / aux.ml
index a33e7228d654b74c2807120bae212334fcdf5374..7c21a61c0b2f19f1fc64628c723d6bc8d00c04f7 100644 (file)
@@ -27,3 +27,10 @@ let rint : float -> float =
   fun f -> 
     if (f -. (floor f)) >= 0.5 then ceil f
     else floor f;;
   fun f -> 
     if (f -. (floor f)) >= 0.5 then ceil f
     else floor f;;
+
+let remainder_float : float -> float -> float = 
+  fun f1 -> fun f2 ->
+    let r = mod_float f1 f2 in
+    if (abs_float r) > ((abs_float f2) /. 2.) then
+      (if r *. f2 > 0. then (r -. f2) else (r +. f2))
+    else r;;