Professional Documents
Culture Documents
Slides MIMS
Slides MIMS
Stef Graillat
Université de Perpignan Via Domitia
Laboratoire LP2A
Équipe de recherche en Informatique DALI
General motivation
Provide numerical algorithms and software being
a few times more accurate than the result from IEEE 754
working precision:
B the actual accuracy is proved to satisfy improved versions of
the “classic rule of thumb”;
efficient in term of running-time without too much portability
sacrifice:
B only working with IEEE 754 precision: single,double;
together with a residual error bound to control the accuracy of
the computed result:
B dynamic and validated error bound computable in IEEE 754
arithmetic.
Example for polynomial evaluation with Horner scheme:
→ the Compensated Horner Scheme1
1
SG, N. Louvet, Ph. Langlois. Compensated Horner Scheme. Submitted to SISC
Stef Graillat Accurate polynomial evaluation
Motivations
Accurate polynomial evaluation
1.5
0.5
−0.5
−1
−1.5
Error analysis
G
b
Forward error
x =G
b b (y )
Error analysis
Backward error
G
b
Forward error
y + ∆y G
x =G
b b (y )
x ) = min {k∆y kD : b
Backward error : η(b x = G (y + ∆y )}
∆y ∈D
x ) = min {k∆y kD : b
Backward error : η(b x = G (y + ∆y )}
∆y ∈D
x ) = min {k∆y kD : b
Backward error : η(b x = G (y + ∆y )}
∆y ∈D
Outline
1 Motivations
Approximation of R by F, rounding fl : R → F
Let x ∈ R then
fl(x) = x(1 + δ), |δ| ≤ u.
Unit roundoff u = /2 for round-to-nearest
Let x, y ∈ F,
Pn i
i=0 |ai ||x| p (|x|)
, always ≥ 1.
e
cond(p, x) = P n i
=
| i=0 ai x | |p(x)|
3 Accuracy of the solution b
p (x):
|p(x) − b
p (x)|
≤ α(n) × cond(p, x) × u
|p(x)|
with α(n) ≈ 2n
Stef Graillat Accurate polynomial evaluation
Motivations
Accurate polynomial evaluation
−2
10
2
−4 γ2n cond u+γ2n cond
10
−6
10
|b
p (x)−p(x)|
|p(x)| ≈u −10
10
−12
10
−14
10
−16
10
−18
10 Classic Horner scheme
Compensated Horner scheme
5
10
10
10 10 1/u
15
10
20
10
25
10
30 1/u2 10
35
Condition number
−2
10
2
−4 γ2n cond u+γ2n cond
10
−6
10
|b
p (x)−p(x)| 2
|p(x)| ≈ cond × u −10
10
−12
10
−14
10
−16
10
−18
10 Classic Horner scheme
Compensated Horner scheme
5
10
10
10 10 1/u
15
10
20
10
25
10
30 1/u2 10
35
Condition number
−2
10
2
−4 γ2n cond u+γ2n cond
10
−6
10
Relative forward error
−8
10
−10
10
−12
10
−14
10
−16
10
−18
10 Classic Horner scheme
Compensated Horner scheme
5
10
10
10 10 1/u
15
10
20
10
25
10
30 1/u2 10
35
Condition number
γn = nu/(1 − nu) ≈ nu
x = fl(a · b) ⇒ a · b = x + y with y ∈ F,
For the product : algorithm TwoProduct by Veltkamp and
Dekker (1971)
Theorem 1
Let p be a polynomial of degree n with floating point coefficients,
and x be a floating point value. Then if no underflow occurs,
|CompHorner(p, x) − p(x)| 2
≤ u + γ2n cond(p, x).
|p(x)| |{z}
≈4n2 u2
(f σ )(|x|) ≤ γ2n e
pπ + pf p (|x|)
−2
10
−6
10
Relative forward error
−8
10
−10
10
−12
10
−14
10
−16
10
−18
10 Classic Horner scheme
Compensated Horner scheme
5
10
10
10 10
15 1/u
10
20
10
25
10
30 1/u2 10
35
Condition number
We compare
Horner: IEEE 754 double precision Horner scheme
CompHorner: our Compensated Horner scheme
DDHorner: Horner scheme with internal double-double
computation
All computations are performed in C language and IEEE 754 double
precision
For every polynomials pn with n varying from 3 to 42:
we perform 100 runs measuring (100) numbers of cycles (TSC
counter for IA-32),
we keep the mean value, the min and the max of the 10
smallest numbers of cycles.
Normalized execution times [Intel Celeron, 2.4GHz, 256kB L2 cache] Normalized execution times [Intel Pentium 4, 3.0GHz, 1024kB L2 cache]
140 100
90
120
80
100 70
Ratio of the compting times
50 CorrectedHorner / Horner
DDHorner / Horner
60 MPFRHorner / Horner
40
CorrectedHorner / Horner
DDHorner / Horner
40 MPFRHorner / Horner 30
20
20
10
0 0
50 100 150 200 250 300 350 400 450 500 50 100 150 200 250 300 350 400 450 500
Degree of the polynomial Degree of the polynomial
Theorem 2
Given a polynomial p of degree n with floating point coefficients,
and a floating point value x, we consider res = CompHorner(p, x).
The absolute forward error affecting the evaluation is bounded
according to
|CompHorner(p, x) − p(x)| ≤
2
fl((u|res| + (γ4n+2 Horner(f σ , |x|) + 2u |res|))).
pπ + pf
−28
10
absolute error
−30
10
−32
10
−34
10
−36
10
0.99 0.992 0.994 0.996 0.998 1 1.002 1.004 1.006 1.008 1.01
Argument x