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)).

Lemma generic_format_F2R' :
forall (x : R) (f : float beta),
F2R f = x ->
(x <> 0%R -> (cexp x <= Fexp f)%Z) ->
generic_format x.