\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\begin{array}{l}
\mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 1.866042173132971 \cdot 10^{+275}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t + x \cdot t}\right) - \frac{x}{z \cdot \left(t + x \cdot t\right)}\\
\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 (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
1.866042173132971e+275)
(/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
(- (+ (/ x (+ x 1.0)) (/ y (+ t (* x t)))) (/ x (* z (+ t (* x t)))))))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 + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= 1.866042173132971e+275) {
tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
} else {
tmp = ((x / (x + 1.0)) + (y / (t + (x * t)))) - (x / (z * (t + (x * t))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.5 |
|---|---|
| Target | 0.3 |
| Herbie | 3.4 |
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.8660421731329709e275Initial program 2.7
if 1.8660421731329709e275 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 60.7
rmApplied clear-num_binary64_1849160.7
Simplified60.7
Taylor expanded around inf 11.6
Simplified11.6
Final simplification3.4
herbie shell --seed 2021014
(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)))