\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\begin{array}{l}
\mathbf{if}\;x \leq -1.2449024052312966 \cdot 10^{+145}:\\
\;\;\;\;\frac{1}{\frac{x + 1}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{\frac{1}{z \cdot t - x}}{\frac{1}{z \cdot y - x}}}{x + 1}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t) :precision binary64 (if (<= x -1.2449024052312966e+145) (/ 1.0 (/ (+ x 1.0) x)) (/ (+ x (/ (/ 1.0 (- (* z t) x)) (/ 1.0 (- (* z y) x)))) (+ x 1.0))))
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 tmp;
if (x <= -1.2449024052312966e+145) {
tmp = 1.0 / ((x + 1.0) / x);
} else {
tmp = (x + ((1.0 / ((z * t) - x)) / (1.0 / ((z * y) - x)))) / (x + 1.0);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 6.8 |
if x < -1.24490240523129657e145Initial program 8.7
rmApplied *-un-lft-identity_binary648.7
Applied *-un-lft-identity_binary648.7
Applied distribute-lft-out_binary648.7
Applied associate-/l*_binary648.7
Simplified8.7
Taylor expanded around 0 2.1
if -1.24490240523129657e145 < x Initial program 7.5
rmApplied *-un-lft-identity_binary647.5
Applied associate-/l*_binary647.5
Simplified7.5
rmApplied div-inv_binary647.5
Applied associate-/r*_binary647.5
Final simplification6.8
herbie shell --seed 2020288
(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.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))