\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;z \leq -1.8309315438264195 \cdot 10^{-90} \lor \neg \left(z \leq 5.350417554604714 \cdot 10^{-20}\right):\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{z \cdot y}{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 (<= z -1.8309315438264195e-90) (not (<= z 5.350417554604714e-20))) (- (/ x (- t (* z a))) (/ y (- (/ t z) a))) (- (/ x (- t (* z a))) (/ (* z 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 ((z <= -1.8309315438264195e-90) || !(z <= 5.350417554604714e-20)) {
tmp = (x / (t - (z * a))) - (y / ((t / z) - a));
} else {
tmp = (x / (t - (z * a))) - ((z * 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.8 |
|---|---|
| Target | 1.8 |
| Herbie | 1.7 |
| Alternative 1 | |
|---|---|
| Error | 1.7 |
| Cost | 1288 |
| Alternative 2 | |
|---|---|
| Error | 5.8 |
| Cost | 1346 |
| Alternative 3 | |
|---|---|
| Error | 18.2 |
| Cost | 1475 |
| Alternative 4 | |
|---|---|
| Error | 18.4 |
| Cost | 1411 |
| Alternative 5 | |
|---|---|
| Error | 18.5 |
| Cost | 776 |
| Alternative 6 | |
|---|---|
| Error | 22.1 |
| Cost | 776 |
| Alternative 7 | |
|---|---|
| Error | 29.8 |
| Cost | 520 |
| Alternative 8 | |
|---|---|
| Error | 41.8 |
| Cost | 513 |
| Alternative 9 | |
|---|---|
| Error | 56.3 |
| Cost | 64 |
| Alternative 10 | |
|---|---|
| Error | 61.7 |
| Cost | 64 |

if z < -1.8309315438264195e-90 or 5.3504175546047138e-20 < z Initial program 18.6
rmApplied div-sub_binary64_2020218.6
Simplified18.6
Simplified18.6
rmApplied *-un-lft-identity_binary64_2019718.6
Applied times-frac_binary64_2020311.9
Simplified11.9
Taylor expanded around 0 18.6
Simplified2.9
Simplified2.9
if -1.8309315438264195e-90 < z < 5.3504175546047138e-20Initial program 0.1
rmApplied div-sub_binary64_202020.1
Simplified0.1
Simplified0.1
Simplified0.1
Final simplification1.7
herbie shell --seed 2021044
(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))))