Library Flocq.Core.Fcore_FLX
This file is part of the Flocq formalization of floating-point
arithmetic in Coq: http://flocq.gforge.inria.fr/
Copyright (C) 2010-2011 Sylvie Boldo
Copyright (C) 2010-2011 Guillaume Melquiond
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
COPYING file for more details.
Copyright (C) 2010-2011 Guillaume Melquiond
Floating-point format without underflow
Require Import Fcore_Raux.
Require Import Fcore_defs.
Require Import Fcore_rnd.
Require Import Fcore_generic_fmt.
Require Import Fcore_float_prop.
Require Import Fcore_FIX.
Require Import Fcore_rnd_ne.
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 }.
Definition FLX_format (x : R) :=
exists f : float beta,
x = F2R f /\ (Zabs (Fnum f) < Zpower beta prec)%Z.
Definition FLX_exp (e : Z) := (e - prec)%Z.
Require Import Fcore_defs.
Require Import Fcore_rnd.
Require Import Fcore_generic_fmt.
Require Import Fcore_float_prop.
Require Import Fcore_FIX.
Require Import Fcore_rnd_ne.
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 }.
Definition FLX_format (x : R) :=
exists f : float beta,
x = F2R f /\ (Zabs (Fnum f) < Zpower beta prec)%Z.
Definition FLX_exp (e : Z) := (e - prec)%Z.
Properties of the FLX format
Global Instance FLX_exp_valid : Valid_exp FLX_exp.
Theorem FIX_format_FLX :
forall x e,
(bpow (e - 1) <= Rabs x <= bpow e)%R ->
FLX_format x ->
FIX_format beta (e - prec) x.
Theorem FLX_format_generic :
forall x, generic_format beta FLX_exp x -> FLX_format x.
Theorem generic_format_FLX :
forall x, FLX_format x -> generic_format beta FLX_exp x.
Theorem FLX_format_satisfies_any :
satisfies_any FLX_format.
Theorem FLX_format_FIX :
forall x e,
(bpow (e - 1) <= Rabs x <= bpow e)%R ->
FIX_format beta (e - prec) x ->
FLX_format x.
unbounded floating-point format with normal mantissas
Definition FLXN_format (x : R) :=
exists f : float beta,
x = F2R f /\ (x <> R0 ->
Zpower beta (prec - 1) <= Zabs (Fnum f) < Zpower beta prec)%Z.
Theorem generic_format_FLXN :
forall x, FLXN_format x -> generic_format beta FLX_exp x.
Theorem FLXN_format_generic :
forall x, generic_format beta FLX_exp x -> FLXN_format x.
Theorem FLXN_format_satisfies_any :
satisfies_any FLXN_format.
exists f : float beta,
x = F2R f /\ (x <> R0 ->
Zpower beta (prec - 1) <= Zabs (Fnum f) < Zpower beta prec)%Z.
Theorem generic_format_FLXN :
forall x, FLXN_format x -> generic_format beta FLX_exp x.
Theorem FLXN_format_generic :
forall x, generic_format beta FLX_exp x -> FLXN_format x.
Theorem FLXN_format_satisfies_any :
satisfies_any FLXN_format.
FLX is a nice format: it has a monotone exponent...
and it allows a rounding to nearest, ties to even.