\frac{x - y}{2 - \left(x + y\right)}
\begin{array}{l}
t_0 := \frac{x - y}{2 - \left(x + y\right)}\\
t_1 := \left|\left|t_0\right|\right|\\
t_2 := {\left(2 - x\right)}^{2}\\
t_3 := \left(\frac{x}{2 - x} + \left(\frac{y \cdot x}{t_2} + \frac{x \cdot \left(y \cdot y\right)}{{\left(2 - x\right)}^{3}}\right)\right) - \left(\frac{y}{2 - x} + \frac{y \cdot y}{t_2}\right)\\
\mathbf{if}\;y \leq -4.5557276941455826 \cdot 10^{-36}:\\
\;\;\;\;\left|\mathsf{log1p}\left(\mathsf{expm1}\left(t_0\right)\right)\right|\\
\mathbf{elif}\;y \leq -2.938866461636586 \cdot 10^{-246}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq -3.8606393500957805 \cdot 10^{-277}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.992168364127104 \cdot 10^{-76}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 6.6951920115568245 \cdot 10^{+78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.135141610076587 \cdot 10^{+127}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.868197491650569 \cdot 10^{+215}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.2577735983466184 \cdot 10^{+240}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{t_0}\right)}^{2}\\
\end{array}
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- x y) (- 2.0 (+ x y))))
(t_1 (fabs (fabs t_0)))
(t_2 (pow (- 2.0 x) 2.0))
(t_3
(-
(+
(/ x (- 2.0 x))
(+ (/ (* y x) t_2) (/ (* x (* y y)) (pow (- 2.0 x) 3.0))))
(+ (/ y (- 2.0 x)) (/ (* y y) t_2)))))
(if (<= y -4.5557276941455826e-36)
(fabs (log1p (expm1 t_0)))
(if (<= y -2.938866461636586e-246)
t_3
(if (<= y -3.8606393500957805e-277)
t_1
(if (<= y 5.992168364127104e-76)
t_3
(if (<= y 6.6951920115568245e+78)
t_1
(if (<= y 2.135141610076587e+127)
-1.0
(if (<= y 1.868197491650569e+215)
t_1
(if (<= y 3.2577735983466184e+240)
-1.0
(pow (sqrt t_0) 2.0)))))))))))double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
double code(double x, double y) {
double t_0 = (x - y) / (2.0 - (x + y));
double t_1 = fabs(fabs(t_0));
double t_2 = pow((2.0 - x), 2.0);
double t_3 = ((x / (2.0 - x)) + (((y * x) / t_2) + ((x * (y * y)) / pow((2.0 - x), 3.0)))) - ((y / (2.0 - x)) + ((y * y) / t_2));
double tmp;
if (y <= -4.5557276941455826e-36) {
tmp = fabs(log1p(expm1(t_0)));
} else if (y <= -2.938866461636586e-246) {
tmp = t_3;
} else if (y <= -3.8606393500957805e-277) {
tmp = t_1;
} else if (y <= 5.992168364127104e-76) {
tmp = t_3;
} else if (y <= 6.6951920115568245e+78) {
tmp = t_1;
} else if (y <= 2.135141610076587e+127) {
tmp = -1.0;
} else if (y <= 1.868197491650569e+215) {
tmp = t_1;
} else if (y <= 3.2577735983466184e+240) {
tmp = -1.0;
} else {
tmp = pow(sqrt(t_0), 2.0);
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 15.4 |
if y < -4.5557276941455826e-36Initial program 0.0
Applied egg-rr17.5
Applied egg-rr17.5
if -4.5557276941455826e-36 < y < -2.93886646163658617e-246 or -3.8606393500957805e-277 < y < 5.9921683641271037e-76Initial program 0.0
Applied egg-rr15.1
Taylor expanded in y around 0 0.0
Simplified0.0
if -2.93886646163658617e-246 < y < -3.8606393500957805e-277 or 5.9921683641271037e-76 < y < 6.6951920115568245e78 or 2.1351416100765869e127 < y < 1.86819749165056882e215Initial program 0.0
Applied egg-rr34.7
Applied egg-rr34.7
if 6.6951920115568245e78 < y < 2.1351416100765869e127 or 1.86819749165056882e215 < y < 3.2577735983466184e240Initial program 0.0
Taylor expanded in x around inf 47.3
if 3.2577735983466184e240 < y Initial program 0.0
Applied egg-rr2.4
Final simplification15.4
herbie shell --seed 2022127
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:herbie-target
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))