Definition Closest (r : R) (p : float) :=
  Fbounded b p /\
  (forall f : float, Fbounded b f -> (Rabs (p - r) <= Rabs (f - r))%R).

(* Specifications: *)
Theorem ClosestTotal : TotalP Closest.
Theorem ClosestCompatible : CompatibleP b radix Closest.
Theorem ClosestMin : forall (r : R) (min max : float), isMin b radix r min -> isMax b radix r max -> (2%nat * r <= min + max)%R -> Closest r min.
Theorem ClosestMax : forall (r : R) (min max : float), isMin b radix r min -> isMax b radix r max -> (min + max <= 2%nat * r)%R -> Closest r max.
Theorem ClosestMinOrMax : MinOrMaxP b radix Closest.
Theorem ClosestMinEq : forall (r : R) (min max p : float), isMin b radix r min -> isMax b radix r max -> (2%nat * r < min + max)%R -> Closest r p -> p = min :>R.
Theorem ClosestMaxEq : forall (r : R) (min max p : float), isMin b radix r min -> isMax b radix r max -> (min + max < 2%nat * r)%R -> Closest r p -> p = max :>R.
Theorem ClosestMonotone : MonotoneP radix Closest.
Theorem ClosestRoundedModeP : RoundedModeP b radix Closest.