\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -1.945477398004434 \cdot 10^{+304}:\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -1.3715219134961312 \cdot 10^{-297}:\\
\;\;\;\;\frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 0:\\
\;\;\;\;\frac{-1}{\frac{\frac{t}{z} - a}{y}}\\
\mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 3.300473813311166 \cdot 10^{+303}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y \cdot z}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-y}{\frac{t}{z} - 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 (<= (/ (- x (* y z)) (- t (* z a))) -1.945477398004434e+304)
(/ (- y) (- (/ t z) a))
(if (<= (/ (- x (* y z)) (- t (* z a))) -1.3715219134961312e-297)
(/ (- x (* y z)) (- t (* z a)))
(if (<= (/ (- x (* y z)) (- t (* z a))) 0.0)
(/ -1.0 (/ (- (/ t z) a) y))
(if (<= (/ (- x (* y z)) (- t (* z a))) 3.300473813311166e+303)
(- (/ x (- t (* z a))) (/ (* y z) (- t (* z a))))
(/ (- y) (- (/ 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))) <= -1.945477398004434e+304) {
tmp = -y / ((t / z) - a);
} else if (((x - (y * z)) / (t - (z * a))) <= -1.3715219134961312e-297) {
tmp = (x - (y * z)) / (t - (z * a));
} else if (((x - (y * z)) / (t - (z * a))) <= 0.0) {
tmp = -1.0 / (((t / z) - a) / y);
} else if (((x - (y * z)) / (t - (z * a))) <= 3.300473813311166e+303) {
tmp = (x / (t - (z * a))) - ((y * z) / (t - (z * a)));
} else {
tmp = -y / ((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.7 |
|---|---|
| Target | 1.5 |
| Herbie | 1.7 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.9454773980044341e304 or 3.300473813311166e303 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 62.1
rmApplied div-inv_binary64_1473862.1
Simplified62.1
Taylor expanded around 0 63.3
Simplified1.3
if -1.9454773980044341e304 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.3715219134961312e-297Initial program 0.2
if -1.3715219134961312e-297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0Initial program 24.0
rmApplied div-inv_binary64_1473824.0
Simplified24.0
Taylor expanded around 0 24.7
Simplified9.4
rmApplied neg-mul-1_binary64_147379.4
Applied associate-/l*_binary64_1468610.1
if 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 3.300473813311166e303Initial program 0.2
rmApplied div-sub_binary64_147460.2
Simplified0.2
Simplified0.2
Final simplification1.7
herbie shell --seed 2021064
(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))))