\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -3.289979231242187938780435609932311249764 \cdot 10^{153}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.562289755990830357227294343969921773158 \cdot 10^{-143}:\\
\;\;\;\;\frac{\frac{x - y}{\frac{x \cdot x + y \cdot y}{x \cdot x - y \cdot y}}}{x - y}\\
\mathbf{elif}\;y \le 7.409492782297067496240750121255910787268 \cdot 10^{-170}:\\
\;\;\;\;\frac{\frac{x - y}{1}}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\end{array}double f(double x, double y) {
double r84243 = x;
double r84244 = y;
double r84245 = r84243 - r84244;
double r84246 = r84243 + r84244;
double r84247 = r84245 * r84246;
double r84248 = r84243 * r84243;
double r84249 = r84244 * r84244;
double r84250 = r84248 + r84249;
double r84251 = r84247 / r84250;
return r84251;
}
double f(double x, double y) {
double r84252 = y;
double r84253 = -3.289979231242188e+153;
bool r84254 = r84252 <= r84253;
double r84255 = -1.0;
double r84256 = -1.5622897559908304e-143;
bool r84257 = r84252 <= r84256;
double r84258 = x;
double r84259 = r84258 - r84252;
double r84260 = r84258 * r84258;
double r84261 = r84252 * r84252;
double r84262 = r84260 + r84261;
double r84263 = r84260 - r84261;
double r84264 = r84262 / r84263;
double r84265 = r84259 / r84264;
double r84266 = r84265 / r84259;
double r84267 = 7.409492782297067e-170;
bool r84268 = r84252 <= r84267;
double r84269 = 1.0;
double r84270 = r84259 / r84269;
double r84271 = r84270 / r84259;
double r84272 = r84258 + r84252;
double r84273 = r84259 * r84272;
double r84274 = r84273 / r84262;
double r84275 = r84268 ? r84271 : r84274;
double r84276 = r84257 ? r84266 : r84275;
double r84277 = r84254 ? r84255 : r84276;
return r84277;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.4 |
|---|---|
| Target | 0.0 |
| Herbie | 5.4 |
if y < -3.289979231242188e+153Initial program 63.8
Taylor expanded around 0 0
if -3.289979231242188e+153 < y < -1.5622897559908304e-143Initial program 0.0
rmApplied associate-/l*0.1
rmApplied flip-+0.0
Applied associate-/r/0.0
Applied associate-/r*0.0
if -1.5622897559908304e-143 < y < 7.409492782297067e-170Initial program 28.6
rmApplied associate-/l*29.6
rmApplied flip-+28.6
Applied associate-/r/28.6
Applied associate-/r*28.6
Taylor expanded around inf 15.8
if 7.409492782297067e-170 < y Initial program 1.2
Final simplification5.4
herbie shell --seed 2020002
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (< 0.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))))