\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 := 1 + \left(a + t_1\right)\\
t_3 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + t_1}\\
t_4 := \frac{y}{\frac{t \cdot t_2}{z}} + \frac{x}{t_2}\\
\mathbf{if}\;t_3 \leq -2.71191800524137 \cdot 10^{-310}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;\frac{z + \frac{x \cdot t}{y}}{b}\\
\mathbf{elif}\;t_3 \leq 2.7517716410186762 \cdot 10^{+261}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;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 (/ (* y b) t))
(t_2 (+ 1.0 (+ a t_1)))
(t_3 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) t_1)))
(t_4 (+ (/ y (/ (* t t_2) z)) (/ x t_2))))
(if (<= t_3 -2.71191800524137e-310)
t_4
(if (<= t_3 0.0)
(/ (+ z (/ (* x t) y)) b)
(if (<= t_3 2.7517716410186762e+261)
t_3
(if (<= t_3 INFINITY) 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 = (y * b) / t;
double t_2 = 1.0 + (a + t_1);
double t_3 = (x + ((y * z) / t)) / ((a + 1.0) + t_1);
double t_4 = (y / ((t * t_2) / z)) + (x / t_2);
double tmp;
if (t_3 <= -2.71191800524137e-310) {
tmp = t_4;
} else if (t_3 <= 0.0) {
tmp = (z + ((x * t) / y)) / b;
} else if (t_3 <= 2.7517716410186762e+261) {
tmp = t_3;
} else if (t_3 <= ((double) INFINITY)) {
tmp = 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
Results
| Original | 16.7 |
|---|---|
| Target | 13.5 |
| Herbie | 6.2 |
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -2.71191800524137e-310 or 2.7517716410186762e261 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 12.7
Simplified12.3
Taylor expanded in z around 0 8.4
Applied associate-/l*_binary645.4
if -2.71191800524137e-310 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 27.7
Simplified19.5
Taylor expanded in z around 0 27.7
Simplified19.8
Taylor expanded in b around inf 21.7
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 2.7517716410186762e261Initial program 0.4
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.6
Taylor expanded in y around inf 2.9
Final simplification6.2
herbie shell --seed 2022125
(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))))