\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -\infty \lor \neg \left(\frac{x - y \cdot z}{t - z \cdot a} \leq -6.0572448180137 \cdot 10^{-321} \lor \neg \left(\frac{x - y \cdot z}{t - z \cdot a} \leq 2.0446532741568272 \cdot 10^{-287}\right) \land \frac{x - y \cdot z}{t - z \cdot a} \leq 3.645992002015573 \cdot 10^{+294}\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y \cdot z}{t - z \cdot 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
(if (or (<= (/ (- x (* y z)) (- t (* z a))) (- INFINITY))
(not
(or (<= (/ (- x (* y z)) (- t (* z a))) -6.0572448180137e-321)
(and (not
(<=
(/ (- x (* y z)) (- t (* z a)))
2.0446532741568272e-287))
(<=
(/ (- x (* y z)) (- t (* z a)))
3.645992002015573e+294)))))
(/ (- y) (- (/ t z) a))
(- (/ x (- t (* z a))) (/ (* y z) (- t (* z 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 tmp;
if ((((x - (y * z)) / (t - (z * a))) <= -((double) INFINITY)) || !((((x - (y * z)) / (t - (z * a))) <= -6.0572448180137e-321) || (!(((x - (y * z)) / (t - (z * a))) <= 2.0446532741568272e-287) && (((x - (y * z)) / (t - (z * a))) <= 3.645992002015573e+294)))) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x / (t - (z * a))) - ((y * z) / (t - (z * a)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 11.1 |
|---|---|
| Target | 1.8 |
| Herbie | 2.2 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0 or -6.05724e-321 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2.0446532741568272e-287 or 3.64599200201557323e294 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 40.7
rmApplied div-inv_binary64_1678440.7
Simplified40.7
Taylor expanded around 0 42.5
Simplified7.5
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -6.05724e-321 or 2.0446532741568272e-287 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 3.64599200201557323e294Initial program 0.2
Taylor expanded around 0 0.2
Final simplification2.2
herbie shell --seed 2021042
(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))))