module Misc:sig..end
module Fresh_name:sig..end
val dichotomy_extended : ('a -> 'a -> 'a) ->
('a -> 'a) ->
('a -> 'a) -> ('a -> Femtolib.Pervasives.comparison) -> 'a -> 'a -> 'adichotomy_extended middle succ pred f inf sup
Same as dichotomy (read its documentation first), but allows one to use another type than int.
One must specify the way to compute the middle of an interval, the successor and the predecessor.
Example:
let f x =
Printf.printf "%.20f\n%!" x;
if x*.x < 2. -. 2.*.epsilon_float then Lt
else if x*.x>2. +. 2.*.epsilon_float then Gt
else Eq;;
let a = dichotomy_extended (fun inf sup -> inf +. (sup-.inf)/.2.) (fun x -> x) (fun x -> x) f 0. 2. in
a, a*.a, sqrt 2., sqrt 2.*.sqrt 2.;;
val dichotomy : (int -> Femtolib.Pervasives.comparison) -> int -> int -> intdichotomy f inf sup
There must be a single element e such that f e is Femtolib.Pervasives.Eq,
f x is Femtolib.Pervasives.Lt for all x<e and
f x is Femtolib.Pervasives.Gt for all x>e.
Returns e