\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
t_2 := \frac{y \cdot b}{t}\\
t_3 := a + t_2\\
t_4 := 1 + t_3\\
t_5 := \frac{t_1}{\left(a + 1\right) + t_2}\\
\mathbf{if}\;t_5 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t_4}, \frac{z}{t}, \frac{x}{a}\right)\\
\mathbf{elif}\;t_5 \leq -2.9537964394486686 \cdot 10^{-297}:\\
\;\;\;\;\frac{-t_1}{-1 - t_3}\\
\mathbf{elif}\;t_5 \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_5 \leq 3.129350475855435 \cdot 10^{+285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{t_4}\\
\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)))
(t_2 (/ (* y b) t))
(t_3 (+ a t_2))
(t_4 (+ 1.0 t_3))
(t_5 (/ t_1 (+ (+ a 1.0) t_2))))
(if (<= t_5 (- INFINITY))
(fma (/ y t_4) (/ z t) (/ x a))
(if (<= t_5 -2.9537964394486686e-297)
(/ (- t_1) (- -1.0 t_3))
(if (<= t_5 0.0)
(-
(fma (/ t y) (/ x b) (/ z b))
(fma (/ t y) (/ z (* b b)) (/ (* a (* z t)) (* y (* b b)))))
(if (<= t_5 3.129350475855435e+285)
(/ (fma (/ y t) z x) t_4)
(/ 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);
double t_2 = (y * b) / t;
double t_3 = a + t_2;
double t_4 = 1.0 + t_3;
double t_5 = t_1 / ((a + 1.0) + t_2);
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = fma((y / t_4), (z / t), (x / a));
} else if (t_5 <= -2.9537964394486686e-297) {
tmp = -t_1 / (-1.0 - t_3);
} else if (t_5 <= 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_5 <= 3.129350475855435e+285) {
tmp = fma((y / t), z, x) / t_4;
} 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.9 |
|---|---|
| Target | 13.1 |
| Herbie | 7.6 |
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 37.7
Simplified21.0
Taylor expanded in a around inf 28.9
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -2.95379643944866858e-297Initial program 0.3
Applied add-cube-cbrt_binary640.6
Applied times-frac_binary641.7
Applied frac-2neg_binary641.7
Simplified0.3
if -2.95379643944866858e-297 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 0.0Initial program 28.5
Taylor expanded in y around inf 28.5
Simplified21.7
if 0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 3.12935047585543522e285Initial program 0.5
Applied add-cube-cbrt_binary640.8
Applied times-frac_binary642.2
Applied associate-/l*_binary645.7
Applied *-un-lft-identity_binary645.7
Applied *-un-lft-identity_binary645.7
Applied times-frac_binary645.7
Simplified5.7
Simplified2.2
if 3.12935047585543522e285 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 61.9
Taylor expanded in y around inf 13.2
Final simplification7.6
herbie shell --seed 2022067
(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))))