\frac{x - y \cdot z}{t - a \cdot z}
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;z \leq -5.011713591805735 \cdot 10^{-75} \lor \neg \left(z \leq 6.890244941997684 \cdot 10^{-165}\right):\\
\;\;\;\;\frac{x}{t_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t_1}\\
\end{array}
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* z a))))
(if (or (<= z -5.011713591805735e-75) (not (<= z 6.890244941997684e-165)))
(- (/ x t_1) (/ y (- (/ t z) a)))
(/ (- x (* z y)) t_1))))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 t_1 = t - (z * a);
double tmp;
if ((z <= -5.011713591805735e-75) || !(z <= 6.890244941997684e-165)) {
tmp = (x / t_1) - (y / ((t / z) - a));
} else {
tmp = (x - (z * y)) / t_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.8 |
|---|---|
| Target | 1.6 |
| Herbie | 1.8 |
if z < -5.01171359180573526e-75 or 6.890244941997684e-165 < z Initial program 15.4
Taylor expanded in x around 0 15.4
Applied associate-/l*_binary649.8
Taylor expanded in t around 0 2.5
if -5.01171359180573526e-75 < z < 6.890244941997684e-165Initial program 0.1
Applied pow1_binary640.1
Final simplification1.8
herbie shell --seed 2022081
(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))))