\frac{x - y \cdot z}{t - a \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -\infty:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{z}{\frac{t - z \cdot a}{y}}\\
\mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -7.019373338049451 \cdot 10^{-308}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{y \cdot z}{t - z \cdot a}\\
\mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 0 \lor \neg \left(\frac{x - y \cdot z}{t - z \cdot a} \leq \infty\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a} - \frac{z}{\sqrt[3]{t - z \cdot a} \cdot \sqrt[3]{t - z \cdot a}} \cdot \frac{y}{\sqrt[3]{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 (<= (/ (- x (* y z)) (- t (* z a))) (- INFINITY))
(- (/ x (- t (* z a))) (/ z (/ (- t (* z a)) y)))
(if (<= (/ (- x (* y z)) (- t (* z a))) -7.019373338049451e-308)
(- (/ x (- t (* z a))) (/ (* y z) (- t (* z a))))
(if (or (<= (/ (- x (* y z)) (- t (* z a))) 0.0)
(not (<= (/ (- x (* y z)) (- t (* z a))) INFINITY)))
(/ (- y (/ x z)) a)
(-
(/ x (- t (* z a)))
(*
(/ z (* (cbrt (- t (* z a))) (cbrt (- t (* z a)))))
(/ y (cbrt (- 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))) <= -((double) INFINITY)) {
tmp = (x / (t - (z * a))) - (z / ((t - (z * a)) / y));
} else if (((x - (y * z)) / (t - (z * a))) <= -7.019373338049451e-308) {
tmp = (x / (t - (z * a))) - ((y * z) / (t - (z * a)));
} else if ((((x - (y * z)) / (t - (z * a))) <= 0.0) || !(((x - (y * z)) / (t - (z * a))) <= ((double) INFINITY))) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x / (t - (z * a))) - ((z / (cbrt(t - (z * a)) * cbrt(t - (z * a)))) * (y / cbrt(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.9 |
| Herbie | 3.4 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 64.0
rmApplied div-sub_binary64_2054364.0
Simplified64.0
Simplified64.0
rmApplied associate-/l*_binary64_204830.4
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -7.01937333804945066e-308Initial program 0.2
Taylor expanded around 0 0.2
if -7.01937333804945066e-308 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0 or +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 34.2
rmApplied div-sub_binary64_2054334.2
Simplified34.2
Simplified34.2
Taylor expanded around inf 12.5
if 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 4.8
rmApplied div-sub_binary64_205434.8
Simplified4.8
Simplified4.8
rmApplied add-cube-cbrt_binary64_205735.2
Applied times-frac_binary64_205442.1
Final simplification3.4
herbie shell --seed 2021032
(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))))