\frac{x - y \cdot z}{t - a \cdot z}
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;\frac{x - y \cdot z}{t_1} \leq 8.902082254793487 \cdot 10^{+295}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-y, z, x\right)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\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 (<= (/ (- x (* y z)) t_1) 8.902082254793487e+295)
(/ (fma (- y) z x) t_1)
(/ y a))))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 (((x - (y * z)) / t_1) <= 8.902082254793487e+295) {
tmp = fma(-y, z, x) / t_1;
} else {
tmp = y / a;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 10.3 |
|---|---|
| Target | 1.6 |
| Herbie | 6.6 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 8.90208225479348708e295Initial program 6.1
Applied egg-rr6.1
if 8.90208225479348708e295 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 59.4
Taylor expanded in z around inf 13.2
Final simplification6.6
herbie shell --seed 2022129
(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))))