# Overview

• Salsa aims at improving the numerical accuracy of programs based on floating-point arithmetic.

• Salsa relies on static analysis by abstract interpretation to compute variable ranges and round-off error bounds.

• Salsa improves the numerical accuracy of the value returned by the function.

• Salsa takes as input ranges for the input variables of programs id ∈ [a,b]. These ranges are given by the user.

• Salsa reduces partly the round-off errors by automatically transforming C-like programs in a source to source manner.

• Salsa accepts programs made of assignments, conditionals, while loop, functions and arrays.

• Salsa has been experimented on various examples coming from embedded systems, iterative methods, numerical algorithms, ...

# Example

Salsa has been evaluated on a suite of control algorithms and numerical methods to improve their numerical accuracy of computations. The experiment results shown that our tool improves significantly their accuracy.

Computing the position (x, y) of a two wheeled robot by odometry in a Cartesian space. The instantaneous rotation speeds sl and sr of the left and right wheels are given.

## Before Transformation

``` sl = [0.52, 0.53, 0.0, 0.0]; %salsa% double main(){ x = 0.0 ; y = 0.0 ; arg = 0.0 ; delta_d = 0.0 ; delta_dl = 0.0 ; delta_dr = 0.0 ; delta_theta = 0.0 ; sr = 0.62831853071 ; t = 0.0; x = 0.0 ; y = 0.0 ; inv_l = 0.1 ; c = 12.34 ; theta = -0.985 ; while (t ‹ 1.0) {   delta_dl = c * sl ;   delta_dr = c * sr ;   delta_d = (delta_dl + delta_dr) * 0.5 ;   delta_theta = (delta_dr - delta_dl) * inv_l ;   arg = theta + (delta_theta * 0.5) ;   z = cosi(arg) ;   x = x + (delta_d * z) ;   q = sini(arg) ;   y = y + (delta_d * q) ;   theta = theta + delta_theta ;   t = t + 0.1;   } return y ; } double cosi(double a){   b = 1.0 - (a * a * 0.5) + ((a * a * a * a) * 0.0416) ;   return b; } double sini(double u){   w = u - ((u * u * u) * 0.1666) + ((u * u * u * u * u) * 0.0083) ;   return w; } ``` ## After Transformation

``` sl = [0.52,0.53,-0.,0.] %salsa% double main() { t = 0.0 ; theta = -0.985 ; y = 0.0 ; x = 0.0 ; arg = 0.0 ; delta_theta = 0.0 ; delta_d = 0.0 ; delta_dr = 0.0 ; delta_dl = 0.0 ; while (t < 1.0) {   delta_dl = (12.34 * sl) ;   delta_dr = 7.753450668961398 ;   delta_d = (0.5 * (delta_dl + delta_dr)) ;   delta_theta = (0.1 * (delta_dr - delta_dl)) ;   arg = (theta + (delta_theta * 0.5)) ;   z = cosiTMP_2(theta,delta_theta) ;   x = (x + (delta_d * z)) ;   q = siniTMP_4(theta,delta_theta) ;   y = (y + (delta_d * q)) ;   theta = (theta + delta_theta) ;   t = (t + 0.1) ;   } ; return y ; } double siniTMP_4(double theta,double delta_theta) {   TMP_3 = (theta + (delta_theta * 0.5)) ;   w = ((TMP_3 - (0.1666 * (TMP_3 * (TMP_3 * TMP_3)))) + (((((0.0083 * TMP_3) * TMP_3) * TMP_3) * TMP_3) * TMP_3)) ;   return w ; } double cosiTMP_2(double theta,double delta_theta) {   TMP_1 = (theta + (delta_theta * 0.5)) ;   b = ((1.0 - (0.5 * (TMP_1 * TMP_1))) + ((((0.0416 * TMP_1) * TMP_1) * TMP_1) * TMP_1)) ;   return b ; } ```

The difference between the two trajectories of the robot before and after transformation. The accuracy of the transformed Odometry program is improved by 21%

# Software Architecture # Documentation

How does Salsa work?

• Salsa receives as input a file corresponding to the program that we aim at improving.

• The program must follows the syntax accepted by Salsa .

• Salsa optimized the value returned by the main function.

• Salsa analyses the input program.

• Salsa transforms this program by applying the intraprocedural and/or interprocedural transformation rules.

• Salsa builds large expressions.

• Salsa calls Sardana to rewrite the arithmetic expressions.

• Sardana re-parses the given arithmetic expression in different ways in order to return a more accurate expression.

• Salsa slices the larger expressions at a defined level of the syntactic tree and assigns them to intermediary variables (TMP).

• Salsa re-analyses the transformed programs recursively until the accuracy is no longer improved.

• Salsa returns as output a file containing the transformed program with best accuracy.

# Parameters

• sliceSize : number corresponds to the height of the syntactic tree where we slice the arithmetic expression.

• ω : width of the intervals corresponding to the values of the arguments of a function.

• ruleSelector : selects which transformation rule to apply.

• widen : number of iterations allowed before applying a widening in static analysis.

# Bibliographie

click here to find more details on our Salsa tool and its different applications.

# News

- Integrating the affine arithmetic to compute a more safe error bounds

# Contacts

For any question, please feel free to send us a mail!