\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 4.9901309863306115 \cdot 10^{+293}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - 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 (<= (/ (- x (* y z)) (- t (* z a))) 4.9901309863306115e+293)))
(/ y a)
(/ (- x (* 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))) <= 4.9901309863306115e+293)) {
tmp = y / a;
} else {
tmp = (x - (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 | 10.3 |
|---|---|
| Target | 1.6 |
| Herbie | 5.5 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0 or 4.9901309863306115e293 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 61.1
rmApplied div-inv_binary64_2019461.1
Simplified61.1
Taylor expanded around inf 16.6
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 4.9901309863306115e293Initial program 4.1
Final simplification5.5
herbie shell --seed 2021097
(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))))