\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;z \leq -2.7861430682011674 \cdot 10^{-150} \lor \neg \left(z \leq 6.438744086964507 \cdot 10^{-43}\right):\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y}{\frac{t - z \cdot a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{t - z \cdot a}{x - z \cdot y}}\\
\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 (or (<= z -2.7861430682011674e-150) (not (<= z 6.438744086964507e-43))) (- (/ x (- t (* z a))) (/ y (/ (- t (* z a)) z))) (/ 1.0 (/ (- t (* z a)) (- x (* z y))))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.7861430682011674e-150) || !(z <= 6.438744086964507e-43)) {
tmp = (x / (t - (z * a))) - (y / ((t - (z * a)) / z));
} else {
tmp = 1.0 / ((t - (z * a)) / (x - (z * y)));
}
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.6 |
|---|---|
| Target | 1.7 |
| Herbie | 7.0 |
if z < -2.7861430682011674e-150 or 6.4387440869645068e-43 < z Initial program 16.1
rmApplied div-sub_binary6416.1
Simplified16.1
Simplified16.1
rmApplied associate-/l*_binary6410.4
if -2.7861430682011674e-150 < z < 6.4387440869645068e-43Initial program 0.1
rmApplied *-un-lft-identity_binary640.1
Applied associate-/l*_binary640.7
Simplified0.7
Final simplification7.0
herbie shell --seed 2020288
(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))))