\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -2.622785819064071 \cdot 10^{37} \lor \neg \left(z \le 5.957888797169072 \cdot 10^{-85}\right):\\
\;\;\;\;\frac{x}{t - a \cdot z} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - a \cdot z} - \frac{y}{t - a \cdot z} \cdot z\\
\end{array}double code(double x, double y, double z, double t, double a) {
return ((double) (((double) (x - ((double) (y * z)))) / ((double) (t - ((double) (a * z))))));
}
double code(double x, double y, double z, double t, double a) {
double VAR;
if (((z <= -2.622785819064071e+37) || !(z <= 5.957888797169072e-85))) {
VAR = ((double) (((double) (x / ((double) (t - ((double) (a * z)))))) - ((double) (y / ((double) (((double) (t / z)) - a))))));
} else {
VAR = ((double) (((double) (x / ((double) (t - ((double) (a * z)))))) - ((double) (((double) (y / ((double) (t - ((double) (a * z)))))) * z))));
}
return VAR;
}




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.8 |
| Herbie | 2.9 |
if z < -2.622785819064071e+37 or 5.957888797169072e-85 < z Initial program 19.1
rmApplied div-sub19.1
rmApplied associate-/l*12.3
Taylor expanded around 0 2.9
if -2.622785819064071e+37 < z < 5.957888797169072e-85Initial program 0.4
rmApplied div-sub0.4
rmApplied associate-/l*3.1
rmApplied associate-/r/2.8
Final simplification2.9
herbie shell --seed 2020122 +o rules:numerics
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))
(/ (- x (* y z)) (- t (* a z))))