\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 := \frac{y \cdot b}{t}\\
t_3 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + t_2}\\
t_4 := \frac{x}{1 + \left(a + t_2\right)}\\
t_5 := \frac{y}{\frac{t_1}{z}} + t_4\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;t_5\\
\mathbf{elif}\;t_3 \leq 1.2131354130988287 \cdot 10^{+250}:\\
\;\;\;\;t_4 + \frac{y \cdot z}{t_1}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_5\\
\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 (/ (* y b) t))
(t_3 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) t_2)))
(t_4 (/ x (+ 1.0 (+ a t_2))))
(t_5 (+ (/ y (/ t_1 z)) t_4)))
(if (<= t_3 (- INFINITY))
t_5
(if (<= t_3 1.2131354130988287e+250)
(+ t_4 (/ (* y z) t_1))
(if (<= t_3 INFINITY) t_5 (/ 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 = (y * b) / t;
double t_3 = (x + ((y * z) / t)) / ((a + 1.0) + t_2);
double t_4 = x / (1.0 + (a + t_2));
double t_5 = (y / (t_1 / z)) + t_4;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_5;
} else if (t_3 <= 1.2131354130988287e+250) {
tmp = t_4 + ((y * z) / t_1);
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_5;
} 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 | 15.9 |
|---|---|
| Target | 12.8 |
| Herbie | 5.5 |
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -inf.0 or 1.21313541309882872e250 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 54.2
Simplified33.8
Taylor expanded in z around 0 34.6
Applied associate-/l*_binary649.4
Taylor expanded in z around inf 9.4
Simplified9.4
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 1.21313541309882872e250Initial program 6.0
Simplified8.8
Taylor expanded in z around 0 7.0
Taylor expanded in z around inf 5.4
Simplified5.2
if +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 64.0
Simplified56.9
Taylor expanded in y around inf 3.3
Final simplification5.5
herbie shell --seed 2022020
(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))))