(** A variant of [ZofB] that bounds the range of representable integers. *)

Definition ZofB_range (f: binary_float) (zmin zmax: Z): option Z :=
  match ZofB f with
  | None => None
  | Some z => if Z.leb zmin z && Z.leb z zmax then Some z else None
  end.

Lemma ZofB_range_inversion: forall f min max n, ZofB_range f min max = Some n -> min <= n /\ n <= max /\ ZofB f = Some n.