.
An Application of Abstract Interpretation to Floating point Arithmetic Yamine A¨ıt Ameur Patrice Cros Juan Jose´ Falcon ´ ´ Alicia Gomez ONERA/CERT-DERI, 2 Ave E. Belin BP 4025, 31055 Toulouse Cedex
Bordeaux, WSA’ 92
Controlling precision in arithmetic expressions
Plan – – – – –
Introduction and Model Formalization Abstract Interpretation Experiment and Prototype Conclusion
WSA’92
1
Bordeaux, September 23–25, 1992
A. Introduction
A Introduction This work was partially supported by CNES as an “Action d’accompagnement” in the AQUARELS project.
A.1 Framework
}
Algorithm
}
Formalization at discrete level
} WSA’92
2
Bordeaux, September 23–25, 1992
A. Introduction
A.2 Model
– Notations
• Arithmetic at Algorithm level, • Several Arithmetics at Machine level,
– Assumptions •
enriched by annotations describing precision constraints
– Correspondance
• analysis to define required precision. • Precision control defined as choice. • Arrow, ( ) as compilation mechanism.
WSA’92
3
Bordeaux, September 23–25, 1992
B.
B !
Formalization
Formalization
B.1 Formalism for – First order language without control structure – Arithmetic expression • Floating point number (as defined by Knuth) • Floating point operations (only "$#$%(')# * ) +
B.2 Formalism for
– IEEE754 Standard to take into account exceptions such as, • overflow • underflow • ...
B.3 Formalism for “
”
Such an arrow must contain, – Some control, in order to make a choice between ,-.0/1 , (static level). – ,--1 interpretation to define (non standard) calculation at precision level. – Mechanism allowing to fix the choice done, (for validation purpose at prototype level).
Using Abstract data types (ADT) for both and
WSA’92
4
2
Bordeaux, September 23–25, 1992
C. Abstract interpretation of
34546
C Abstract interpretation of
C.1 Normalized floating point numbers: Finite Set
.
Using base 10 for example, let 798
,;:=A@CBD1
be the floating point number set, (m and e stand for mantissa and exponent). – for all studied programs in ,--1 , there exists a theoretical “minimum” number of significant digits for mantissa and exponent, such that exceptions do not occur. – Let E and F be those values. .
8 ]
8
,
P&:RQTSVUPWQBYXW
P&:RQVSC_`PWQBaXb@XZ:RQVSc_d[eQB\1 7f8 ] 8 . g ,h:iA@kB\1
C.2 Concrete domain – Defined with, 7
• constants, • arithmetic expressions, ( [O>lP&>g)>^m ) • first order functions.
WSA’92
5
Bordeaux, September 23–25, 1992
C. Abstract interpretation of
34546
C.3 Abstract domain – Constants, (property) noqpr 7
Ps
:iL@tBaPsu
-
pVv > pVwx
s stands for size (number of significant digits which is the studied property, “precision”). – lower bound : u – upper bound : u
Sy>zS E{>zF
x x
– Powerset extension 7 - o|p rk} : BYPs -
– Equations n G~7 ,/1G } : B qtr -fP
s } : 7 B qk : n B 8
,S1 7 ,t/1
n 8 u Sy>zS x n 8 u?E{>zF x n 8 u pv > pwx
8 n - o|p : | t : n BRB qk :=- qo p t , /1tB,t/1
WSA’92
6
Bordeaux, September 23–25, 1992
C. Abstract interpretation of
C.4 Lifted operations, (
34546
)
– Addition uz@ x
[Wu