\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, b, \mathsf{fma}\left(a, t, t\right)\right)\\
t_2 := x + \frac{y \cdot z}{t}\\
t_3 := \frac{y \cdot b}{t}\\
t_4 := \frac{t_2}{\left(a + 1\right) + t_3}\\
\mathbf{if}\;t_4 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{t_1}{z}} + \frac{x}{1 + \left(a + t_3\right)}\\
\mathbf{elif}\;t_4 \leq -1.4113307000283498 \cdot 10^{-272}:\\
\;\;\;\;\frac{t_2}{\left(a + 1\right) + \frac{1}{\frac{t}{y \cdot b}}}\\
\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\frac{y \cdot z}{t_1} + \frac{x}{1 + \mathsf{fma}\left(b, \frac{y}{t}, a\right)}\\
\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 (fma y b (fma a t t)))
(t_2 (+ x (/ (* y z) t)))
(t_3 (/ (* y b) t))
(t_4 (/ t_2 (+ (+ a 1.0) t_3))))
(if (<= t_4 (- INFINITY))
(+ (/ y (/ t_1 z)) (/ x (+ 1.0 (+ a t_3))))
(if (<= t_4 -1.4113307000283498e-272)
(/ t_2 (+ (+ a 1.0) (/ 1.0 (/ t (* y b)))))
(if (<= t_4 INFINITY)
(+ (/ (* y z) t_1) (/ x (+ 1.0 (fma b (/ y t) a))))
(/ 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 = fma(y, b, fma(a, t, t));
double t_2 = x + ((y * z) / t);
double t_3 = (y * b) / t;
double t_4 = t_2 / ((a + 1.0) + t_3);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = (y / (t_1 / z)) + (x / (1.0 + (a + t_3)));
} else if (t_4 <= -1.4113307000283498e-272) {
tmp = t_2 / ((a + 1.0) + (1.0 / (t / (y * b))));
} else if (t_4 <= ((double) INFINITY)) {
tmp = ((y * z) / t_1) + (x / (1.0 + fma(b, (y / t), a)));
} 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.4 |
|---|---|
| Target | 13.4 |
| Herbie | 5.4 |
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 64.0
Taylor expanded in x around 0 40.1
Taylor expanded in z around inf 40.0
Simplified40.0
Applied associate-/l*_binary649.0
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -1.4113307000283498e-272Initial program 0.4
Applied clear-num_binary640.4
if -1.4113307000283498e-272 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 13.5
Taylor expanded in x around 0 12.4
Taylor expanded in z around inf 10.4
Simplified10.1
Applied associate-/l*_binary649.3
Taylor expanded in x around 0 10.1
Simplified8.5
if +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 64.0
Taylor expanded in y around inf 2.6
Final simplification5.4
herbie shell --seed 2021275
(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))))