\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 := 1 + \left(a + t_2\right)\\
t_4 := \frac{t_1}{\left(a + 1\right) + t_2}\\
\mathbf{if}\;t_4 \leq -7.463236257714043 \cdot 10^{-294}:\\
\;\;\;\;\frac{y}{\frac{t \cdot t_3}{z}} + \frac{x}{t_3}\\
\mathbf{elif}\;t_4 \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_4 \leq 1.5790514337013136 \cdot 10^{+300}:\\
\;\;\;\;\frac{t_1}{t_3}\\
\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 (+ 1.0 (+ a t_2)))
(t_4 (/ t_1 (+ (+ a 1.0) t_2))))
(if (<= t_4 -7.463236257714043e-294)
(+ (/ y (/ (* t t_3) z)) (/ x t_3))
(if (<= t_4 0.0)
(-
(fma (/ t y) (/ x b) (/ z b))
(fma (/ t y) (/ z (* b b)) (/ (* a (* z t)) (* y (* b b)))))
(if (<= t_4 1.5790514337013136e+300) (/ t_1 t_3) (/ 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 = 1.0 + (a + t_2);
double t_4 = t_1 / ((a + 1.0) + t_2);
double tmp;
if (t_4 <= -7.463236257714043e-294) {
tmp = (y / ((t * t_3) / z)) + (x / t_3);
} else if (t_4 <= 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_4 <= 1.5790514337013136e+300) {
tmp = t_1 / t_3;
} 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.2 |
|---|---|
| Target | 13.5 |
| Herbie | 7.0 |
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -7.46323625771404329e-294Initial program 7.3
Taylor expanded in x around 0 5.5
Applied associate-/l*_binary644.3
if -7.46323625771404329e-294 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 28.6
Taylor expanded in y around inf 29.1
Simplified21.8
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 1.5790514337013136e300Initial program 0.5
Applied *-un-lft-identity_binary640.5
Applied *-un-lft-identity_binary640.5
Applied times-frac_binary640.5
Simplified0.5
Simplified0.5
if 1.5790514337013136e300 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 56.0
Taylor expanded in y around inf 11.4
Final simplification7.0
herbie shell --seed 2022068
(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))))