\frac{x - y \cdot z}{t - a \cdot z}
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;\begin{array}{l}
t_2 := \frac{x - y \cdot z}{t_1}\\
t_2 \leq -\infty \lor \neg \left(t_2 \leq 1.781182093012614 \cdot 10^{+307}\right)
\end{array}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t_1} - \frac{y \cdot z}{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 (- t (* z a))))
(if (let* ((t_2 (/ (- x (* y z)) t_1)))
(or (<= t_2 (- INFINITY)) (not (<= t_2 1.781182093012614e+307))))
(/ y a)
(- (/ x t_1) (/ (* y z) 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 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 1.781182093012614e+307)) {
tmp = y / a;
} else {
tmp = (x / t_1) - ((y * z) / 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.1 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0 or 1.7811820930126139e307 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 63.8
Taylor expanded in z around inf 14.5
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 1.7811820930126139e307Initial program 4.0
Applied add-cube-cbrt_binary644.9
Applied *-un-lft-identity_binary644.9
Applied times-frac_binary644.9
Taylor expanded in x around 0 4.0
Simplified4.0
Final simplification5.1
herbie shell --seed 2021329
(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))))