\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\begin{array}{l}
\mathbf{if}\;t \le -1.54215107921783331 \cdot 10^{-37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right) \cdot \frac{1}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\
\mathbf{elif}\;t \le 1.03638931227158246 \cdot 10^{242}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{1}{\frac{t}{y \cdot b}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}\\
\end{array}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 VAR;
if ((t <= -1.5421510792178333e-37)) {
VAR = (fma((y / t), z, x) * (1.0 / (a + fma((y / t), b, 1.0))));
} else {
double VAR_1;
if ((t <= 1.0363893122715825e+242)) {
VAR_1 = ((x + ((y * z) / t)) / ((a + 1.0) + (1.0 / (t / (y * b)))));
} else {
VAR_1 = (1.0 / ((a + fma((y / t), b, 1.0)) / fma((y / t), z, x)));
}
VAR = VAR_1;
}
return VAR;
}




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.5 |
|---|---|
| Target | 13.5 |
| Herbie | 14.0 |
if t < -1.5421510792178333e-37Initial program 11.5
rmApplied associate-+l+11.5
Simplified8.8
rmApplied *-un-lft-identity8.8
Applied associate-/r*8.8
Simplified5.1
rmApplied div-inv5.2
if -1.5421510792178333e-37 < t < 1.0363893122715825e+242Initial program 18.9
rmApplied clear-num18.9
if 1.0363893122715825e+242 < t Initial program 14.1
rmApplied associate-+l+14.1
Simplified9.1
rmApplied *-un-lft-identity9.1
Applied associate-/r*9.1
Simplified0.8
rmApplied clear-num1.3
Final simplification14.0
herbie shell --seed 2020075 +o rules:numerics
(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 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b)))))))
(/ (+ x (/ (* y z) t)) (+ (+ a 1) (/ (* y b) t))))