\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\begin{array}{l}
\mathbf{if}\;z \le -2.79387100773201889 \cdot 10^{-122}:\\
\;\;\;\;\frac{1}{\frac{x + 1}{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)}} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\
\mathbf{elif}\;z \le 2.684402167383186 \cdot 10^{86}:\\
\;\;\;\;\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}double code(double x, double y, double z, double t) {
return ((x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0));
}
double code(double x, double y, double z, double t) {
double temp;
if ((z <= -2.793871007732019e-122)) {
temp = ((1.0 / ((x + 1.0) / fma((y / ((t * z) - x)), z, x))) - ((x / ((t * z) - x)) / (x + 1.0)));
} else {
double temp_1;
if ((z <= 2.684402167383186e+86)) {
temp_1 = ((x + (((y * z) - x) / ((t * z) - x))) * (1.0 / (x + 1.0)));
} else {
temp_1 = ((x + (y / t)) / (x + 1.0));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.4 |
|---|---|
| Target | 0.3 |
| Herbie | 3.2 |
if z < -2.793871007732019e-122Initial program 10.7
rmApplied div-sub10.7
Applied associate-+r-10.7
Applied div-sub10.7
Simplified4.5
rmApplied clear-num4.6
Simplified4.6
if -2.793871007732019e-122 < z < 2.684402167383186e+86Initial program 0.6
rmApplied div-inv0.7
if 2.684402167383186e+86 < z Initial program 19.5
Taylor expanded around inf 7.5
Final simplification3.2
herbie shell --seed 2020058 +o rules:numerics
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1)))