\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -3.306610229065552697766015508018533353152 \cdot 10^{-6}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.040149902759510101461916731014611092466 \cdot 10^{-136}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{\frac{{x}^{4} - {y}^{4}}{\left(x + y\right) \cdot \left(x - y\right)}}\\
\mathbf{elif}\;y \le -4.002205660206990449557576569903637397741 \cdot 10^{-171}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 2.245790742829554397735960283721886784496 \cdot 10^{-222}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 5.875513051791536100179706901856990854373 \cdot 10^{-203}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 8.954732963342977511317338914679377322524 \cdot 10^{-75}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{\frac{{x}^{4} - {y}^{4}}{\left(x + y\right) \cdot \left(x - y\right)}}\\
\end{array}double f(double x, double y) {
double r58384 = x;
double r58385 = y;
double r58386 = r58384 - r58385;
double r58387 = r58384 + r58385;
double r58388 = r58386 * r58387;
double r58389 = r58384 * r58384;
double r58390 = r58385 * r58385;
double r58391 = r58389 + r58390;
double r58392 = r58388 / r58391;
return r58392;
}
double f(double x, double y) {
double r58393 = y;
double r58394 = -3.3066102290655527e-06;
bool r58395 = r58393 <= r58394;
double r58396 = -1.0;
double r58397 = -1.0401499027595101e-136;
bool r58398 = r58393 <= r58397;
double r58399 = x;
double r58400 = r58399 - r58393;
double r58401 = r58399 + r58393;
double r58402 = r58400 * r58401;
double r58403 = 4.0;
double r58404 = pow(r58399, r58403);
double r58405 = pow(r58393, r58403);
double r58406 = r58404 - r58405;
double r58407 = r58401 * r58400;
double r58408 = r58406 / r58407;
double r58409 = r58402 / r58408;
double r58410 = -4.0022056602069904e-171;
bool r58411 = r58393 <= r58410;
double r58412 = 2.2457907428295544e-222;
bool r58413 = r58393 <= r58412;
double r58414 = 1.0;
double r58415 = 5.875513051791536e-203;
bool r58416 = r58393 <= r58415;
double r58417 = 8.954732963342978e-75;
bool r58418 = r58393 <= r58417;
double r58419 = r58418 ? r58414 : r58409;
double r58420 = r58416 ? r58396 : r58419;
double r58421 = r58413 ? r58414 : r58420;
double r58422 = r58411 ? r58396 : r58421;
double r58423 = r58398 ? r58409 : r58422;
double r58424 = r58395 ? r58396 : r58423;
return r58424;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.8 |
|---|---|
| Target | 0.0 |
| Herbie | 12.8 |
if y < -3.3066102290655527e-06 or -1.0401499027595101e-136 < y < -4.0022056602069904e-171 or 2.2457907428295544e-222 < y < 5.875513051791536e-203Initial program 30.0
Taylor expanded around 0 4.6
if -3.3066102290655527e-06 < y < -1.0401499027595101e-136 or 8.954732963342978e-75 < y Initial program 0.0
rmApplied flip-+13.4
Simplified13.7
Simplified13.8
if -4.0022056602069904e-171 < y < 2.2457907428295544e-222 or 5.875513051791536e-203 < y < 8.954732963342978e-75Initial program 22.6
Taylor expanded around inf 20.6
Final simplification12.8
herbie shell --seed 2019325
(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))))