Skip to content
Snippets Groups Projects
Commit 0e4878bd authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[Eva] avoid triggering warning 16 (unerasable-optional-argument)

parent 735ebf09
No related branches found
No related tags found
No related merge requests found
...@@ -331,16 +331,16 @@ module Exact : Arithmetic with type forward = I.t = struct ...@@ -331,16 +331,16 @@ module Exact : Arithmetic with type forward = I.t = struct
I.narrow x.exact (I.neg r.exact) I.narrow x.exact (I.neg r.exact)
let add x y r = [x ; y ; r] >>+ fun _ -> let add x y r = [x ; y ; r] >>+ fun _ ->
I.backward_add ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact I.backward_add ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact ()
let sub x y r = [x ; y ; r] >>+ fun _ -> let sub x y r = [x ; y ; r] >>+ fun _ ->
I.backward_sub ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact I.backward_sub ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact ()
let mul x y r = [x ; y ; r] >>+ fun _ -> let mul x y r = [x ; y ; r] >>+ fun _ ->
I.backward_mul ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact I.backward_mul ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact ()
let div x y r = [x ; y ; r] >>+ fun _ -> let div x y r = [x ; y ; r] >>+ fun _ ->
I.backward_div ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact I.backward_div ~prec:P.Real ~left:x.exact ~right:y.exact ~result:r.exact ()
end end
...@@ -378,16 +378,16 @@ module Approx : Arithmetic with type forward = I.t = struct ...@@ -378,16 +378,16 @@ module Approx : Arithmetic with type forward = I.t = struct
I.narrow x.approx (I.neg r.approx) I.narrow x.approx (I.neg r.approx)
let add x y r = [x ; y ; r] >>+ fun prec -> let add x y r = [x ; y ; r] >>+ fun prec ->
I.backward_add ~prec ~left:x.approx ~right:y.approx ~result:r.approx I.backward_add ~prec ~left:x.approx ~right:y.approx ~result:r.approx ()
let sub x y r = [x ; y ; r] >>+ fun prec -> let sub x y r = [x ; y ; r] >>+ fun prec ->
I.backward_sub ~prec ~left:x.approx ~right:y.approx ~result:r.approx I.backward_sub ~prec ~left:x.approx ~right:y.approx ~result:r.approx ()
let mul x y r = [x ; y ; r] >>+ fun prec -> let mul x y r = [x ; y ; r] >>+ fun prec ->
I.backward_mul ~prec ~left:x.approx ~right:y.approx ~result:r.approx I.backward_mul ~prec ~left:x.approx ~right:y.approx ~result:r.approx ()
let div x y r = [x ; y ; r] >>+ fun prec -> let div x y r = [x ; y ; r] >>+ fun prec ->
I.backward_div ~prec ~left:x.approx ~right:y.approx ~result:r.approx I.backward_div ~prec ~left:x.approx ~right:y.approx ~result:r.approx ()
end end
......
...@@ -441,7 +441,7 @@ let finite_values ~prec = function ...@@ -441,7 +441,7 @@ let finite_values ~prec = function
let max = F.min (F.maximal_pos_float prec) y in let max = F.min (F.maximal_pos_float prec) y in
if max < min then None else Some (min, max) if max < min then None else Some (min, max)
let backward_op (op : operator) fnan ?(prec = Precisions.Real) value result = let backward_op (op : operator) fnan ?(prec = Precisions.Real) value result () =
if contains_infinity result || (contains_nan value && contains_nan result) if contains_infinity result || (contains_nan value && contains_nan result)
then `Value (top prec) then `Value (top prec)
else else
...@@ -471,7 +471,7 @@ let synthetize left right = ...@@ -471,7 +471,7 @@ let synthetize left right =
| `Value left, `Value right -> `Value (left, right) | `Value left, `Value right -> `Value (left, right)
[@@inline] [@@inline]
let backward_add ?(prec = Precisions.Real) ~left ~right ~result = let backward_add ?(prec = Precisions.Real) ~left ~right ~result () =
let reduce_for_nan value = let reduce_for_nan value =
match contains_pos_infinity value, contains_neg_infinity value with match contains_pos_infinity value, contains_neg_infinity value with
| true , true -> I (F.neg_inf prec, F.pos_inf prec, true) | true , true -> I (F.neg_inf prec, F.pos_inf prec, true)
...@@ -479,38 +479,38 @@ let backward_add ?(prec = Precisions.Real) ~left ~right ~result = ...@@ -479,38 +479,38 @@ let backward_add ?(prec = Precisions.Real) ~left ~right ~result =
| false, true -> I (F.pos_inf prec, F.pos_inf prec, true) | false, true -> I (F.pos_inf prec, F.pos_inf prec, true)
| false, false -> NaN prec | false, false -> NaN prec
in in
let right' = backward_op F.sub reduce_for_nan ~prec left result in let right' = backward_op F.sub reduce_for_nan ~prec left result () in
let left' = backward_op F.sub reduce_for_nan ~prec right result in let left' = backward_op F.sub reduce_for_nan ~prec right result () in
synthetize left' right' synthetize left' right'
let backward_sub ?(prec = Precisions.Real) ~left ~right ~result = let backward_sub ?(prec = Precisions.Real) ~left ~right ~result () =
match backward_add ~prec ~left ~right:(neg right) ~result with match backward_add ~prec ~left ~right:(neg right) ~result () with
| `Bottom -> `Bottom | `Bottom -> `Bottom
| `Value (left, right) -> `Value (left, neg right) | `Value (left, right) -> `Value (left, neg right)
let backward_mul ?(prec = Precisions.Real) ~left ~right ~result = let backward_mul ?(prec = Precisions.Real) ~left ~right ~result () =
let reduce_for_nan value = let reduce_for_nan value =
match contains_infinity value, contains_a_zero value with match contains_infinity value, contains_a_zero value with
| true, _ | _, true -> I (F.neg_inf prec, F.pos_inf prec, true) | true, _ | _, true -> I (F.neg_inf prec, F.pos_inf prec, true)
| false, false -> NaN prec | false, false -> NaN prec
in in
let right' = backward_op F.div reduce_for_nan ~prec left result in let right' = backward_op F.div reduce_for_nan ~prec left result () in
let left' = backward_op F.div reduce_for_nan ~prec right result in let left' = backward_op F.div reduce_for_nan ~prec right result () in
synthetize left' right' synthetize left' right'
let backward_div ?(prec = Precisions.Real) ~left ~right ~result = let backward_div ?(prec = Precisions.Real) ~left ~right ~result () =
let reduce_for_nan value = let reduce_for_nan value =
match contains_infinity value, contains_a_zero value with match contains_infinity value, contains_a_zero value with
| true, _ | _, true -> I (F.neg_inf prec, F.pos_inf prec, true) | true, _ | _, true -> I (F.neg_inf prec, F.pos_inf prec, true)
| false, false -> NaN prec | false, false -> NaN prec
in in
let right' = let right' =
match backward_op F.div reduce_for_nan ~prec left result with match backward_op F.div reduce_for_nan ~prec left result () with
| `Value right' -> | `Value right' ->
let one = F.of_int ~prec 1 in let one = F.of_int ~prec 1 in
let one = I (one, one, false) in let one = I (one, one, false) in
`Value (div ~prec one right') `Value (div ~prec one right')
| `Bottom -> `Bottom | `Bottom -> `Bottom
in in
let left' = backward_op F.div reduce_for_nan ~prec right result in let left' = backward_op F.div reduce_for_nan ~prec right result () in
synthetize left' right' synthetize left' right'
...@@ -182,10 +182,10 @@ val backward_gt : ?prec:Precisions.t -> t -> t -> t Bottom.or_bottom ...@@ -182,10 +182,10 @@ val backward_gt : ?prec:Precisions.t -> t -> t -> t Bottom.or_bottom
(** These functions perform backward propagation for arithmetic *) (** These functions perform backward propagation for arithmetic *)
val backward_add : ?prec:Precisions.t -> left:t -> right:t -> val backward_add : ?prec:Precisions.t -> left:t -> right:t ->
result:t -> (t * t) Bottom.or_bottom result:t -> unit -> (t * t) Bottom.or_bottom
val backward_sub : ?prec:Precisions.t -> left:t -> right:t -> val backward_sub : ?prec:Precisions.t -> left:t -> right:t ->
result:t -> (t * t) Bottom.or_bottom result:t -> unit -> (t * t) Bottom.or_bottom
val backward_mul : ?prec:Precisions.t -> left:t -> right:t -> val backward_mul : ?prec:Precisions.t -> left:t -> right:t ->
result:t -> (t * t) Bottom.or_bottom result:t -> unit -> (t * t) Bottom.or_bottom
val backward_div : ?prec:Precisions.t -> left:t -> right:t -> val backward_div : ?prec:Precisions.t -> left:t -> right:t ->
result:t -> (t * t) Bottom.or_bottom result:t -> unit -> (t * t) Bottom.or_bottom
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment