\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t_1 \leq -4.152181355139608 \cdot 10^{-284}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{1 + \left(a + \frac{y}{\frac{t}{b}}\right)}, \frac{z}{t}, \frac{x}{1 + \mathsf{fma}\left(b, \frac{y}{t}, a\right)}\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y}, \frac{x}{b}, \frac{z}{b}\right) - \mathsf{fma}\left(\frac{t}{y}, \frac{z}{b \cdot b}, \frac{a \cdot \left(z \cdot t\right)}{y \cdot \left(b \cdot b\right)}\right)\\
\mathbf{elif}\;t_1 \leq 4.064482167495813 \cdot 10^{+299}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
(FPCore (x y z t a b) :precision binary64 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_1 -4.152181355139608e-284)
(fma
(/ y (+ 1.0 (+ a (/ y (/ t b)))))
(/ z t)
(/ x (+ 1.0 (fma b (/ y t) a))))
(if (<= t_1 0.0)
(-
(fma (/ t y) (/ x b) (/ z b))
(fma (/ t y) (/ z (* b b)) (/ (* a (* z t)) (* y (* b b)))))
(if (<= t_1 4.064482167495813e+299) t_1 (/ z b))))))double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_1 <= -4.152181355139608e-284) {
tmp = fma((y / (1.0 + (a + (y / (t / b))))), (z / t), (x / (1.0 + fma(b, (y / t), a))));
} else if (t_1 <= 0.0) {
tmp = fma((t / y), (x / b), (z / b)) - fma((t / y), (z / (b * b)), ((a * (z * t)) / (y * (b * b))));
} else if (t_1 <= 4.064482167495813e+299) {
tmp = t_1;
} else {
tmp = z / b;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
| Original | 16.6 |
|---|---|
| Target | 12.9 |
| Herbie | 8.5 |
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -4.1521813551396081e-284Initial program 7.3
Simplified9.8
Taylor expanded in z around 0 5.3
Simplified9.6
Applied fma-udef_binary649.6
Simplified7.7
Applied associate-/l*_binary647.7
if -4.1521813551396081e-284 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 28.1
Simplified18.7
Taylor expanded in y around inf 27.7
Simplified22.1
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 4.0644821674958132e299Initial program 0.4
if 4.0644821674958132e299 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 63.2
Simplified51.9
Taylor expanded in y around inf 12.9
Final simplification8.5
herbie shell --seed 2022068
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(if (< t -1.3659085366310088e-271) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b)))))))
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))