\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le 3.23474552151853 \cdot 10^{-205}:\\
\;\;\;\;\frac{-y}{\frac{x \cdot x}{y} + y}\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\sqrt{e^{\frac{x \cdot x}{y \cdot y + x \cdot x}}}\right) + \log \left(\sqrt{e^{\frac{x \cdot x}{y \cdot y + x \cdot x}}}\right)\right) - \frac{y}{\frac{x \cdot x}{y} + y}\\
\end{array}double f(double x, double y) {
double r2954233 = x;
double r2954234 = y;
double r2954235 = r2954233 - r2954234;
double r2954236 = r2954233 + r2954234;
double r2954237 = r2954235 * r2954236;
double r2954238 = r2954233 * r2954233;
double r2954239 = r2954234 * r2954234;
double r2954240 = r2954238 + r2954239;
double r2954241 = r2954237 / r2954240;
return r2954241;
}
double f(double x, double y) {
double r2954242 = x;
double r2954243 = 3.23474552151853e-205;
bool r2954244 = r2954242 <= r2954243;
double r2954245 = y;
double r2954246 = -r2954245;
double r2954247 = r2954242 * r2954242;
double r2954248 = r2954247 / r2954245;
double r2954249 = r2954248 + r2954245;
double r2954250 = r2954246 / r2954249;
double r2954251 = r2954245 * r2954245;
double r2954252 = r2954251 + r2954247;
double r2954253 = r2954247 / r2954252;
double r2954254 = exp(r2954253);
double r2954255 = sqrt(r2954254);
double r2954256 = log(r2954255);
double r2954257 = r2954256 + r2954256;
double r2954258 = r2954245 / r2954249;
double r2954259 = r2954257 - r2954258;
double r2954260 = r2954244 ? r2954250 : r2954259;
return r2954260;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.3 |
|---|---|
| Target | 0.0 |
| Herbie | 5.2 |
if x < 3.23474552151853e-205Initial program 30.8
Simplified30.8
rmApplied associate-/l*30.9
Taylor expanded around 0 20.3
Simplified20.3
Taylor expanded around inf 7.7
if 3.23474552151853e-205 < x Initial program 14.7
Simplified14.7
rmApplied associate-/l*14.6
Taylor expanded around 0 3.8
Simplified3.8
rmApplied add-log-exp3.8
rmApplied add-sqr-sqrt3.8
Applied log-prod3.8
Final simplification5.2
herbie shell --seed 2019135
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 0 x 1) (< y 1))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1 (/ 2 (+ 1 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))