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

(** Properties when the real number is "small" (kind of subnormal) *)
Theorem mantissa_small_pos :
forall x ex,
(bpow (ex - 1) <= x < bpow ex)%R ->
(ex <= fexp ex)%Z ->
(0 < x * bpow (- fexp ex) < 1)%R.