\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y - z\right)}{y}\\
t_1 := \frac{x}{\frac{y}{y - z}}\\
\mathbf{if}\;t_0 \leq -5.479237903309544 \cdot 10^{+281}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := x - \frac{x \cdot z}{y}\\
\mathbf{if}\;t_0 \leq -1.3096297358974076 \cdot 10^{-144}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;x - \frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;t_0 \leq 6.41878949445327 \cdot 10^{+301}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (- y z)) y)) (t_1 (/ x (/ y (- y z)))))
(if (<= t_0 -5.479237903309544e+281)
t_1
(let* ((t_2 (- x (/ (* x z) y))))
(if (<= t_0 -1.3096297358974076e-144)
t_2
(if (<= t_0 0.0)
(- x (/ z (/ y x)))
(if (<= t_0 6.41878949445327e+301) t_2 t_1)))))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double t_0 = (x * (y - z)) / y;
double t_1 = x / (y / (y - z));
double tmp;
if (t_0 <= -5.479237903309544e+281) {
tmp = t_1;
} else {
double t_2 = x - ((x * z) / y);
double tmp_1;
if (t_0 <= -1.3096297358974076e-144) {
tmp_1 = t_2;
} else if (t_0 <= 0.0) {
tmp_1 = x - (z / (y / x));
} else if (t_0 <= 6.41878949445327e+301) {
tmp_1 = t_2;
} else {
tmp_1 = t_1;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 13.0 |
|---|---|
| Target | 3.2 |
| Herbie | 0.9 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < -5.4792379033095441e281 or 6.4187894944532703e301 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 57.9
Applied associate-/l*_binary641.7
if -5.4792379033095441e281 < (/.f64 (*.f64 x (-.f64 y z)) y) < -1.3096297358974076e-144 or -0.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < 6.4187894944532703e301Initial program 0.4
Taylor expanded in y around 0 0.2
if -1.3096297358974076e-144 < (/.f64 (*.f64 x (-.f64 y z)) y) < -0.0Initial program 20.5
Taylor expanded in y around 0 10.4
Applied associate-/l*_binary643.6
Final simplification0.9
herbie shell --seed 2021280
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))