Section RND_FLX.
Variable beta : radix.
Notation bpow e := (bpow beta e).
Variable prec : Z.
Class Prec_gt_0 :=
prec_gt_0 : (0 < prec)%Z.
Context { prec_gt_0_ : Prec_gt_0 }.
Inductive FLX_format (x : R) : Prop :=
FLX_spec (f : float beta) :
x = F2R f -> (Z.abs (Fnum f) < Zpower beta prec)%Z -> FLX_format x.
Definition FLX_exp (e : Z) := (e - prec)%Z.
(** Properties of the FLX format *)
Global Instance FLX_exp_valid : Valid_exp FLX_exp.
Proof with auto with typeclass_instances.
intros x e Hx Fx.
apply FLX_format_generic.
apply generic_format_FIX in Fx.
revert Fx.
apply generic_inclusion with (e := e)...
apply Z.le_refl.
Qed.
(** unbounded floating-point format with normal mantissas *)
Inductive FLXN_format (x : R) : Prop :=
FLXN_spec (f : float beta) :
x = F2R f ->
(x <> 0%R -> Zpower beta (prec - 1) <= Z.abs (Fnum f) < Zpower beta prec)%Z ->
FLXN_format x.
Proof with auto with typeclass_instances.
intros rnd Hr x Hx.
assert (K: (0 <= round beta FLX_exp rnd x)%R).
rewrite <- (round_0 beta FLX_exp rnd).
apply round_le... now apply Rlt_le.
destruct K; try easy.
absurd (x = 0)%R.
now apply Rgt_not_eq.
apply eq_0_round_0_FLX with rnd...
Qed.

Theorem ulp_FLX_le :
forall x, (ulp beta FLX_exp x <= Rabs x * bpow (1-prec))%R.