\frac{x - y \cdot z}{t - a \cdot z}
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \frac{x - y \cdot z}{t_1}\\
t_3 := \frac{-y}{\frac{t}{z} - a}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_2 \leq -1.4270783779407967 \cdot 10^{-308}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq 2.725755847603695 \cdot 10^{+272}\right):\\
\;\;\;\;t_3\\
\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)))
(t_2 (/ (- x (* y z)) t_1))
(t_3 (/ (- y) (- (/ t z) a))))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 -1.4270783779407967e-308)
t_2
(if (or (<= t_2 0.0) (not (<= t_2 2.725755847603695e+272)))
t_3
(- (/ 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 t_3 = -y / ((t / z) - a);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= -1.4270783779407967e-308) {
tmp = t_2;
} else if ((t_2 <= 0.0) || !(t_2 <= 2.725755847603695e+272)) {
tmp = t_3;
} 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.5 |
|---|---|
| Target | 1.6 |
| Herbie | 2.0 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0 or -1.4270783779407967e-308 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0 or 2.7257558476036951e272 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 39.5
rmApplied div-inv_binary6439.5
Simplified39.5
Taylor expanded around 0 41.6
Simplified7.3
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.4270783779407967e-308Initial program 0.2
rmApplied clear-num_binary640.4
Simplified0.4
Taylor expanded around 0 0.2
Simplified0.2
if -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2.7257558476036951e272Initial program 0.2
rmApplied div-sub_binary640.2
Simplified0.2
Simplified0.2
Final simplification2.0
herbie shell --seed 2021196
(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))))