\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -4.326946295935711 \cdot 10^{-306}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - y \cdot \frac{z}{t - z \cdot a}\\
\mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 4.603345585494796 \cdot 10^{-273}:\\
\;\;\;\;\frac{1}{\frac{t}{x - y \cdot z} - z \cdot \frac{a}{x - y \cdot z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y}{\frac{t}{z} - a}\\
\end{array}(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
(FPCore (x y z t a)
:precision binary64
(if (<= (/ (- x (* y z)) (- t (* z a))) -4.326946295935711e-306)
(- (/ x (- t (* z a))) (* y (/ z (- t (* z a)))))
(if (<= (/ (- x (* y z)) (- t (* z a))) 4.603345585494796e-273)
(/ 1.0 (- (/ t (- x (* y z))) (* z (/ a (- x (* y z))))))
(- (/ x (- t (* z a))) (/ y (- (/ t z) a))))))double code(double x, double y, double z, double t, double a) {
return (((double) (x - ((double) (y * z)))) / ((double) (t - ((double) (a * z)))));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((((double) (x - ((double) (y * z)))) / ((double) (t - ((double) (z * a))))) <= -4.326946295935711e-306)) {
tmp = ((double) ((x / ((double) (t - ((double) (z * a))))) - ((double) (y * (z / ((double) (t - ((double) (z * a)))))))));
} else {
double tmp_1;
if (((((double) (x - ((double) (y * z)))) / ((double) (t - ((double) (z * a))))) <= 4.603345585494796e-273)) {
tmp_1 = (1.0 / ((double) ((t / ((double) (x - ((double) (y * z))))) - ((double) (z * (a / ((double) (x - ((double) (y * z))))))))));
} else {
tmp_1 = ((double) ((x / ((double) (t - ((double) (z * a))))) - (y / ((double) ((t / z) - a)))));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 10.5 |
|---|---|
| Target | 1.5 |
| Herbie | 2.2 |
if (/ (- x (* y z)) (- t (* a z))) < -4.32694629593571e-306Initial program Error: 5.1 bits
rmApplied div-subError: 5.1 bits
SimplifiedError: 5.1 bits
SimplifiedError: 1.6 bits
if -4.32694629593571e-306 < (/ (- x (* y z)) (- t (* a z))) < 4.603345585494796e-273Initial program Error: 21.9 bits
rmApplied clear-numError: 23.0 bits
SimplifiedError: 23.0 bits
rmApplied div-subError: 24.1 bits
SimplifiedError: 24.1 bits
SimplifiedError: 5.5 bits
if 4.603345585494796e-273 < (/ (- x (* y z)) (- t (* a z))) Initial program Error: 11.3 bits
rmApplied div-subError: 11.3 bits
SimplifiedError: 11.3 bits
SimplifiedError: 8.1 bits
rmApplied pow1Error: 8.1 bits
Applied pow1Error: 8.1 bits
Applied pow-prod-downError: 8.1 bits
SimplifiedError: 1.4 bits
Final simplificationError: 2.2 bits
herbie shell --seed 2020203
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))
(/ (- x (* y z)) (- t (* a z))))