\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{x}{t_2}\\
\mathbf{if}\;t_3 \leq -8.818781100815444 \cdot 10^{-35}:\\
\;\;\;\;z \cdot \frac{y}{t \cdot t_2} + t_4\\
\mathbf{elif}\;t_3 \leq 1.2837857584797247 \cdot 10^{-59}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{1 + \mathsf{fma}\left(b, \frac{y}{t}, a\right)}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_4 + z \cdot \frac{y}{y \cdot b + \left(t + t \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;t_4 + \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 (/ x t_2)))
(if (<= t_3 -8.818781100815444e-35)
(+ (* z (/ y (* t t_2))) t_4)
(if (<= t_3 1.2837857584797247e-59)
(/ (fma y (/ z t) x) (+ 1.0 (fma b (/ y t) a)))
(if (<= t_3 INFINITY)
(+ t_4 (* z (/ y (+ (* y b) (+ t (* t a))))))
(+ 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 = x / t_2;
double tmp;
if (t_3 <= -8.818781100815444e-35) {
tmp = (z * (y / (t * t_2))) + t_4;
} else if (t_3 <= 1.2837857584797247e-59) {
tmp = fma(y, (z / t), x) / (1.0 + fma(b, (y / t), a));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4 + (z * (y / ((y * b) + (t + (t * a)))));
} else {
tmp = t_4 + (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.3 |
|---|---|
| Target | 13.4 |
| Herbie | 5.1 |
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -8.8187811008154439e-35Initial program 10.3
Taylor expanded in x around 0 6.1
Applied associate-/l*_binary643.4
Applied associate-/r/_binary641.0
if -8.8187811008154439e-35 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 1.28378575847972467e-59Initial program 11.5
Simplified9.7
if 1.28378575847972467e-59 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 11.5
Taylor expanded in x around 0 7.0
Applied associate-/l*_binary644.0
Applied associate-/r/_binary641.6
Taylor expanded in a around 0 1.6
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 x around 0 60.9
Taylor expanded in y around inf 2.6
Final simplification5.1
herbie shell --seed 2022061
(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))))