\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.1130146121076096 \cdot 10^{+286}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{z \cdot \left(t \cdot \left(x + 1\right)\right)}\\
\mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -0.0023831738495721276:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x \cdot x - 1} \cdot \left(x - 1\right)\\
\mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2.5040233921767497 \cdot 10^{-08} \lor \neg \left(\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 7.6995530812136 \cdot 10^{+279}\right):\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{z \cdot \left(t \cdot \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(\frac{y \cdot z}{z \cdot t - x} - \frac{x}{z \cdot t - x}\right)}{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 (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
-1.1130146121076096e+286)
(- (+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0)))) (/ x (* z (* t (+ x 1.0)))))
(if (<=
(/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
-0.0023831738495721276)
(* (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (- (* x x) 1.0)) (- x 1.0))
(if (or (<=
(/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
2.5040233921767497e-08)
(not
(<=
(/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
7.6995530812136e+279)))
(-
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(/ x (* z (* t (+ x 1.0)))))
(/
(+ x (- (/ (* y z) (- (* z t) x)) (/ x (- (* z t) 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 + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= -1.1130146121076096e+286) {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (z * (t * (x + 1.0))));
} else if (((x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= -0.0023831738495721276) {
tmp = ((x + (((y * z) - x) / ((z * t) - x))) / ((x * x) - 1.0)) * (x - 1.0);
} else if ((((x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= 2.5040233921767497e-08) || !(((x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= 7.6995530812136e+279)) {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (z * (t * (x + 1.0))));
} else {
tmp = (x + (((y * z) / ((z * t) - x)) - (x / ((z * t) - 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.3 |
| Herbie | 1.6 |
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -1.11301461210760956e286 or -0.0023831738495721276 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 2.50402339217674974e-8 or 7.6995530812136002e279 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 24.2
Taylor expanded around inf 4.9
Simplified4.9
if -1.11301461210760956e286 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -0.0023831738495721276Initial program 0.4
rmApplied flip-+_binary64_177840.4
Applied associate-/r/_binary64_177560.4
Simplified0.4
if 2.50402339217674974e-8 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 7.6995530812136002e279Initial program 0.1
rmApplied div-sub_binary64_178150.1
Simplified0.1
Simplified0.1
Final simplification1.6
herbie shell --seed 2021007
(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)))