\frac{x - y \cdot z}{t - a \cdot z}
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 3.296855121476003 \cdot 10^{+288}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;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 (/ (- x (* y z)) (- t (* z a)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 3.296855121476003e+288)))
(/ y a)
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 = (x - (y * z)) / (t - (z * a));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 3.296855121476003e+288)) {
tmp = y / a;
} else {
tmp = 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.2 |
|---|---|
| Target | 1.6 |
| Herbie | 5.2 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0 or 3.29685512147600273e288 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 60.4
Taylor expanded in z around inf 15.0
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 3.29685512147600273e288Initial program 4.0
Final simplification5.2
herbie shell --seed 2021275
(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))))