\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 := \frac{t_1}{\left(a + 1\right) + t_2}\\
\mathbf{if}\;t_3 \leq -1.8638644872226573 \cdot 10^{+193}:\\
\;\;\;\;\begin{array}{l}
t_4 := 1 + \left(a + t_2\right)\\
\mathsf{fma}\left(\frac{y}{t_4}, \frac{z}{t}, \frac{x}{t_4}\right)
\end{array}\\
\mathbf{elif}\;t_3 \leq 2.792327012157869 \cdot 10^{+304}:\\
\;\;\;\;\frac{t_1}{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 (+ x (/ (* y z) t)))
(t_2 (/ (* y b) t))
(t_3 (/ t_1 (+ (+ a 1.0) t_2))))
(if (<= t_3 -1.8638644872226573e+193)
(let* ((t_4 (+ 1.0 (+ a t_2)))) (fma (/ y t_4) (/ z t) (/ x t_4)))
(if (<= t_3 2.792327012157869e+304)
(/ t_1 (+ 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 = x + ((y * z) / t);
double t_2 = (y * b) / t;
double t_3 = t_1 / ((a + 1.0) + t_2);
double tmp;
if (t_3 <= -1.8638644872226573e+193) {
double t_4_1 = 1.0 + (a + t_2);
tmp = fma((y / t_4_1), (z / t), (x / t_4_1));
} else if (t_3 <= 2.792327012157869e+304) {
tmp = t_1 / (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.5 |
|---|---|
| Target | 13.3 |
| Herbie | 7.2 |
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -1.86386448722265732e193Initial program 32.3
Simplified23.0
Taylor expanded in y around 0 32.5
Taylor expanded in z around 0 21.4
Simplified11.0
if -1.86386448722265732e193 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 2.7923270121578691e304Initial program 6.5
Simplified8.8
Taylor expanded in y around 0 5.9
Applied +-commutative_binary645.9
if 2.7923270121578691e304 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 63.4
Simplified52.4
Taylor expanded in y around inf 12.3
Final simplification7.2
herbie shell --seed 2021291
(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))))