Library FArgReduct3

FArgReduct3 file

Sylvie Boldo

This file explains an improvement of Cody & Waite argument reduction technique using the FMA (fused-multiply-and-add).
Require Export FArgReduct2.

Section Total.
Let radix := 2%Z.

Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.

Variables

Variable b : Fbound.
Variables prec : nat.
Variable N : Z.
Variables alpha gamma x zH1 u : float.
Variable zL : R.

Various bounds

Let bmoinsq :=
  Bound
    (P_of_succ_nat (pred (Zabs_nat (Zpower_nat radix (prec - 2)%nat))))
    (dExp b).

All the hypotheses

Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix prec.
Hypothesis Fboundedx : Fbounded b x.
Hypothesis xCanonic : Fcanonic radix b x.
Hypothesis xPos : (0 <= x)%R.

alpha (the constant, such as pi) and gamma (its inverse)
Hypothesis alphaNormal : Fnormal radix b alpha.
Hypothesis gammaNormal : Fnormal radix bmoinsq gamma.
Hypothesis alphaPos : (0 < alpha)%R.
Hypothesis gammaPos : (0 < gamma)%R.
Hypothesis
  gamma_not_pow_2 : forall e : Z, FtoRradix gamma <> powerRZ radix e.
Hypothesis gammaDef : Closest bmoinsq radix (/ alpha) gamma.

About the computation of z
Hypothesis
  uDef :
    Closest b radix
      (3%nat * powerRZ radix (Zpred (Zpred (prec - N))) + x * alpha) u.
Hypothesis
  zH1Def :
    Closest b radix (u - 3%nat * powerRZ radix (Zpred (Zpred (prec - N))))
      zH1.

Hypothesis precMoreThanThree : 3 < prec.
Hypothesis N_not_too_big : (N <= dExp b)%Z.

x not too big
Hypothesis
  xalpha_small :
    (x * alpha <=
     powerRZ radix (Zpred (Zpred (prec - N))) - powerRZ radix (- N))%R.

No underflow
Hypothesis gamma_ge: (powerRZ radix (-dExp b+prec+(Zmax (-1) N))<= gamma)%R.

A few lemmas
Theorem gamma_ge2: (powerRZ radix (-dExp b+prec -2 +(Zmax 1 (N-1)))<= gamma)%R.

Theorem exp_gamma_enough2: (- dExp b <= Zpred (Zpred (Fexp gamma)))%Z.

Theorem exp_alpha_le: (- dExp b <= 3 + - (Fexp alpha + (prec + prec)))%Z.

Theorem exp_gamma_enough3: (- dExp b <= Fexp gamma - N-3)%Z.

Theorem gamma_p:
 ex (fun gam2 : float => FtoRradix gam2 = gamma /\ Fnormal radix b gam2 /\ (Fexp gam2=Zpred (Zpred (Fexp gamma))) /\
   ((powerRZ radix (Zpred prec))+4 <=Fnum gam2)%R /\ (Fnum gam2 <= (powerRZ radix prec)-4)%R).

Main result: q=2

Theorem Fmac_arg_reduct_correct3 :
 ex (fun u : float => FtoRradix u = (x - zH1 * gamma)%R /\ Fbounded b u)
  /\ (Rabs (x-zH1*gamma) < powerRZ radix (prec-N+Fexp gamma))%R.
End Total.