\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -7.46567153473929 \cdot 10^{+293}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 2.5016904252996703 \cdot 10^{+299}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y \cdot z}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{y}}\\
\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 (<= (/ (- x (* y z)) (- t (* z a))) -7.46567153473929e+293)
(/ y a)
(if (<= (/ (- x (* y z)) (- t (* z a))) 2.5016904252996703e+299)
(- (/ x (- t (* z a))) (/ (* y z) (- t (* z a))))
(/ 1.0 (/ a y)))))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))) <= -7.46567153473929e+293) {
tmp = y / a;
} else if (((x - (y * z)) / (t - (z * a))) <= 2.5016904252996703e+299) {
tmp = (x / (t - (z * a))) - ((y * z) / (t - (z * a)));
} else {
tmp = 1.0 / (a / y);
}
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.7 |
| Herbie | 5.7 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -7.46567153473928992e293Initial program 57.3
Taylor expanded around inf 26.7
if -7.46567153473928992e293 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2.50169042529967034e299Initial program 4.3
Taylor expanded around 0 4.3
if 2.50169042529967034e299 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 62.2
rmApplied clear-num_binary64_2190162.2
Simplified62.2
Taylor expanded around inf 12.4
Final simplification5.7
herbie shell --seed 2021023
(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))))