\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
t_1 := \frac{y \cdot b}{t}\\
t_2 := \frac{x}{1 + \left(a + t_1\right)}\\
t_3 := \left(a + 1\right) + t_1\\
t_4 := \frac{x + \frac{y \cdot z}{t}}{t_3}\\
\mathbf{if}\;t_4 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{1 + \left(a + \frac{y}{\frac{t}{b}}\right)}, \frac{z}{t}, t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_5 := x + \left(y \cdot z\right) \cdot \frac{1}{t}\\
\mathbf{if}\;t_4 \leq -5.7172199925063 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_5}{t_3}\\
\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;\frac{z + \frac{x \cdot t}{y}}{b}\\
\mathbf{elif}\;t_4 \leq 9.35937687403725 \cdot 10^{+270}:\\
\;\;\;\;\frac{t_5}{\left(a + 1\right) + \frac{1}{\frac{t}{y \cdot b}}}\\
\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{1 + \left(a + y \cdot \frac{b}{t}\right)}, \frac{z}{t}, t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}\\
\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 (/ (* y b) t))
(t_2 (/ x (+ 1.0 (+ a t_1))))
(t_3 (+ (+ a 1.0) t_1))
(t_4 (/ (+ x (/ (* y z) t)) t_3)))
(if (<= t_4 (- INFINITY))
(fma (/ y (+ 1.0 (+ a (/ y (/ t b))))) (/ z t) t_2)
(let* ((t_5 (+ x (* (* y z) (/ 1.0 t)))))
(if (<= t_4 -5.7172199925063e-310)
(/ t_5 t_3)
(if (<= t_4 0.0)
(/ (+ z (/ (* x t) y)) b)
(if (<= t_4 9.35937687403725e+270)
(/ t_5 (+ (+ a 1.0) (/ 1.0 (/ t (* y b)))))
(if (<= t_4 INFINITY)
(fma (/ y (+ 1.0 (+ a (* y (/ b t))))) (/ z t) t_2)
(/ 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 = (y * b) / t;
double t_2 = x / (1.0 + (a + t_1));
double t_3 = (a + 1.0) + t_1;
double t_4 = (x + ((y * z) / t)) / t_3;
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = fma((y / (1.0 + (a + (y / (t / b))))), (z / t), t_2);
} else {
double t_5 = x + ((y * z) * (1.0 / t));
double tmp_1;
if (t_4 <= -5.7172199925063e-310) {
tmp_1 = t_5 / t_3;
} else if (t_4 <= 0.0) {
tmp_1 = (z + ((x * t) / y)) / b;
} else if (t_4 <= 9.35937687403725e+270) {
tmp_1 = t_5 / ((a + 1.0) + (1.0 / (t / (y * b))));
} else if (t_4 <= ((double) INFINITY)) {
tmp_1 = fma((y / (1.0 + (a + (y * (b / t))))), (z / t), t_2);
} else {
tmp_1 = z / b;
}
tmp = tmp_1;
}
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 | 13.5 |
| Herbie | 5.3 |
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 39.5
Simplified16.8
Applied associate-/l*_binary6416.8
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -5.7172199925063e-310Initial program 0.4
Applied div-inv_binary640.4
if -5.7172199925063e-310 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 31.0
Taylor expanded in x around 0 31.0
Simplified31.1
Taylor expanded in b around inf 20.1
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 9.35937687403724969e270Initial program 0.6
Applied div-inv_binary640.6
Applied clear-num_binary640.6
if 9.35937687403724969e270 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 50.4
Taylor expanded in x around 0 30.0
Simplified14.8
Applied *-un-lft-identity_binary6414.8
Applied times-frac_binary6414.8
Simplified14.8
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 3.0
Final simplification5.3
herbie shell --seed 2021329
(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))))