\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{x}{t_1}\\
\mathbf{if}\;t_2 \leq -5.15120624 \cdot 10^{-316}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt[3]{t_1}\\
t_3 - \frac{y}{t_4 \cdot t_4} \cdot \frac{z}{t_4}
\end{array}\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;t_2 \leq 2.5937576388216173 \cdot 10^{+162}:\\
\;\;\;\;t_3 - \frac{y \cdot z}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_3 - \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
(let* ((t_1 (- t (* z a))) (t_2 (/ (- x (* y z)) t_1)) (t_3 (/ x t_1)))
(if (<= t_2 -5.15120624e-316)
(let* ((t_4 (cbrt t_1))) (- t_3 (* (/ y (* t_4 t_4)) (/ z t_4))))
(if (<= t_2 0.0)
(/ (- y (/ x z)) a)
(if (<= t_2 2.5937576388216173e+162)
(- t_3 (/ (* y z) t_1))
(- t_3 (/ 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 t_1 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double t_3 = x / t_1;
double tmp;
if (t_2 <= -5.15120624e-316) {
double t_4_1 = cbrt(t_1);
tmp = t_3 - ((y / (t_4_1 * t_4_1)) * (z / t_4_1));
} else if (t_2 <= 0.0) {
tmp = (y - (x / z)) / a;
} else if (t_2 <= 2.5937576388216173e+162) {
tmp = t_3 - ((y * z) / t_1);
} else {
tmp = t_3 - (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.9 |
| Herbie | 3.7 |
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -5.151206239e-316Initial program 4.5
Taylor expanded in x around 0 4.5
Applied add-cube-cbrt_binary644.9
Applied times-frac_binary643.1
if -5.151206239e-316 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0Initial program 26.3
Taylor expanded in x around 0 26.3
Taylor expanded in t around 0 27.2
Simplified16.6
if 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2.5937576388216173e162Initial program 0.2
Taylor expanded in x around 0 0.2
if 2.5937576388216173e162 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 34.8
Taylor expanded in x around 0 34.8
Applied *-un-lft-identity_binary6434.8
Applied times-frac_binary6421.0
Simplified21.0
Simplified21.0
Taylor expanded in y around 0 34.8
Simplified0.1
Final simplification3.7
herbie shell --seed 2022019
(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))))