\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;z \leq -2.901768712204357 \cdot 10^{-14} \lor \neg \left(z \leq 5.062448218448348 \cdot 10^{-131}\right):\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\left(x - z \cdot y\right) \cdot \frac{1}{t - z \cdot a}\\
\end{array}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 VAR;
if (((z <= -2.901768712204357e-14) || !(z <= 5.062448218448348e-131))) {
VAR = ((double) ((x / ((double) (t - ((double) (z * a))))) - (y / ((double) ((t / z) - a)))));
} else {
VAR = ((double) (((double) (x - ((double) (z * y)))) * (1.0 / ((double) (t - ((double) (z * a)))))));
}
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.4 |
|---|---|
| Target | 1.7 |
| Herbie | 1.8 |
if z < -2.90176871220435715e-14 or 5.06244821844834846e-131 < z Initial program 16.8
rmApplied div-sub16.8
Simplified16.8
Simplified11.1
rmApplied pow111.1
Applied pow111.1
Applied pow-prod-down11.1
Simplified2.8
if -2.90176871220435715e-14 < z < 5.06244821844834846e-131Initial program 0.1
rmApplied div-inv0.3
Simplified0.3
Final simplification1.8
herbie shell --seed 2020199
(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))))