Section Format.
Variable fexp : Z -> Z.
(** To be a good fexp *)
Class Valid_exp :=
valid_exp :
forall k : Z,
( (fexp k < k)%Z -> (fexp (k + 1) <= k)%Z ) /\
( (k <= fexp k)%Z ->
(fexp (fexp k + 1) <= fexp k)%Z /\
forall l : Z, (l <= fexp k)%Z -> fexp l = fexp k ).
Context { valid_exp_ : Valid_exp }.
Definition cexp x :=
fexp (mag beta x).
Definition canonical (f : float beta) :=
Fexp f = cexp (F2R f).
Definition scaled_mantissa x :=
(x * bpow (- cexp x))%R.
Definition generic_format (x : R) :=
x = F2R (Float beta (Ztrunc (scaled_mantissa x)) (cexp x)).

Theorem generic_format_F2R :
forall m e,
( m <> 0 -> cexp (F2R (Float beta m e)) <= e )%Z ->
generic_format (F2R (Float beta m e)).