\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
t_1 := 1 + \mathsf{fma}\left(b, \frac{y}{t}, a\right)\\
t_2 := \frac{x}{t_1}\\
\mathbf{if}\;t \leq -2.1055779123004298 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \frac{1}{t_1}, \frac{z}{t}, t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{if}\;t \leq 6.2810140716487435 \cdot 10^{-263}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq 1.046109116160516 \cdot 10^{-31}:\\
\;\;\;\;\frac{y \cdot z}{\mathsf{fma}\left(y, b, \mathsf{fma}\left(a, t, t\right)\right)} + \frac{x}{1 + \left(a + \frac{y \cdot b}{t}\right)}\\
\mathbf{elif}\;t \leq 31525899.08026222:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t_1}, \frac{z}{t}, t_2\right)\\
\end{array}\\
\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 (+ 1.0 (fma b (/ y t) a))) (t_2 (/ x t_1)))
(if (<= t -2.1055779123004298e-85)
(fma (* y (/ 1.0 t_1)) (/ z t) t_2)
(let* ((t_3 (/ (+ z (/ (* t x) y)) b)))
(if (<= t 6.2810140716487435e-263)
t_3
(if (<= t 1.046109116160516e-31)
(+
(/ (* y z) (fma y b (fma a t t)))
(/ x (+ 1.0 (+ a (/ (* y b) t)))))
(if (<= t 31525899.08026222) t_3 (fma (/ y t_1) (/ z t) t_2))))))))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 = 1.0 + fma(b, (y / t), a);
double t_2 = x / t_1;
double tmp;
if (t <= -2.1055779123004298e-85) {
tmp = fma((y * (1.0 / t_1)), (z / t), t_2);
} else {
double t_3 = (z + ((t * x) / y)) / b;
double tmp_1;
if (t <= 6.2810140716487435e-263) {
tmp_1 = t_3;
} else if (t <= 1.046109116160516e-31) {
tmp_1 = ((y * z) / fma(y, b, fma(a, t, t))) + (x / (1.0 + (a + ((y * b) / t))));
} else if (t <= 31525899.08026222) {
tmp_1 = t_3;
} else {
tmp_1 = fma((y / t_1), (z / t), t_2);
}
tmp = tmp_1;
}
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 | 15.7 |
|---|---|
| Target | 13.2 |
| Herbie | 9.9 |
if t < -2.1055779123004298e-85Initial program 11.6
Simplified6.5
Taylor expanded in z around 0 12.7
Simplified5.4
Applied div-inv_binary645.4
if -2.1055779123004298e-85 < t < 6.28101407164874353e-263 or 1.046109116160516e-31 < t < 31525899.080262221Initial program 23.8
Simplified32.2
Taylor expanded in z around 0 18.9
Simplified32.5
Taylor expanded in b around inf 22.5
if 6.28101407164874353e-263 < t < 1.046109116160516e-31Initial program 19.1
Simplified28.1
Taylor expanded in z around 0 15.6
Taylor expanded in z around inf 10.7
Simplified10.7
if 31525899.080262221 < t Initial program 10.5
Simplified3.7
Taylor expanded in z around 0 11.9
Simplified2.5
Final simplification9.9
herbie shell --seed 2022088
(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))))