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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.8 |
|---|---|
| Target | 0.4 |
| Herbie | 3.5 |
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 4.0025907719432432e271Initial program 2.9
Taylor expanded around 0 2.9
if 4.0025907719432432e271 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 61.2
Taylor expanded around inf 9.9
Final simplification3.5
herbie shell --seed 2021064
(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)))