Added some missing operators

This commit is contained in:
Cédric Pasteur 2011-09-06 14:19:45 +02:00
parent 33bc0adff1
commit e7e81f2637

View file

@ -83,6 +83,10 @@ let apply_op partial loc op se_list =
| "/", [Sint n1; Sint n2] ->
if n2 = 0 then raise (Evaluation_failed (Division_by_zero, loc));
Sint (n1 / n2)
| "*.", [Sfloat f1; Sfloat f2] -> Sfloat (f1 *. f2)
| "/.", [Sfloat f1; Sfloat f2] ->
if f2 = 0.0 then raise (Evaluation_failed (Division_by_zero, loc));
Sfloat (f1 /. f2)
| "=", [Sint n1; Sint n2] -> Sbool (n1 = n2)
| "<=", [Sint n1; Sint n2] -> Sbool (n1 <= n2)
| ">=", [Sint n1; Sint n2] -> Sbool (n1 >= n2)
@ -92,6 +96,7 @@ let apply_op partial loc op se_list =
| "or", [Sbool b1; Sbool b2] -> Sbool (b1 || b2)
| "not", [Sbool b] -> Sbool (not b)
| "~-", [Sint n] -> Sint (-n)
| "~-.", [Sfloat f] -> Sfloat (-. f)
| f,_ -> Misc.internal_error ("Static evaluation failed of the pervasive operator "^f)
)
else