Library Closest2Plus
Require Export ClosestPlus.
Require Export Closest2Prop.
Section F2.
Variable b : Fbound.
Variable precision : nat.
Let radix := 2%Z.
Coercion Local FtoRradix := FtoR radix.
Theorem TwoMoreThanOne : (1 < radix)%Z.
Hint Resolve TwoMoreThanOne.
Hypothesis precisionNotZero : 1 < precision.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Theorem plusUpperBound :
forall P,
RoundedModeP b 2%nat P ->
forall p q pq : float,
P (p + q)%R pq ->
Fbounded b p ->
Fbounded b q -> (Rabs pq <= radix * Rmax (Rabs p) (Rabs q))%R.
Theorem plusErrorBound2 :
forall p q r : float,
Fbounded b p ->
Fbounded b q ->
Closest b radix (p + q) r ->
~ is_Fzero r ->
(Rabs (r - (p + q)) < radix * / pPred (vNum b) * Rmax (Rabs p) (Rabs q))%R.
Theorem plusClosestLowerBoundAux1 :
forall p q pq : float,
(Rabs q <= p)%R ->
Closest b radix (p + q) pq ->
Fbounded b p -> Fbounded b q -> pq <> (p + q)%R :>R -> (/ radix * p <= pq)%R.
Theorem plusClosestLowerBoundAux2 :
forall p q pq : float,
Closest b radix (p + q) pq ->
Fbounded b p ->
Fbounded b q ->
pq <> (p + q)%R :>R ->
(Rabs p <= Rabs q)%R -> (/ radix * Rabs q <= Rabs pq)%R.
Theorem plusClosestLowerBound :
forall p q pq : float,
Closest b radix (p + q) pq ->
Fbounded b p ->
Fbounded b q ->
pq <> (p + q)%R :>R -> (/ radix * Rmax (Rabs p) (Rabs q) <= Rabs pq)%R.
End F2.