\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 r81890 = x;
double r81891 = y;
double r81892 = r81890 - r81891;
double r81893 = r81890 + r81891;
double r81894 = r81892 * r81893;
double r81895 = r81890 * r81890;
double r81896 = r81891 * r81891;
double r81897 = r81895 + r81896;
double r81898 = r81894 / r81897;
return r81898;
}
double f(double x, double y) {
double r81899 = y;
double r81900 = -3.3066102290655527e-06;
bool r81901 = r81899 <= r81900;
double r81902 = -1.0;
double r81903 = -1.0401499027595101e-136;
bool r81904 = r81899 <= r81903;
double r81905 = x;
double r81906 = r81905 - r81899;
double r81907 = r81905 + r81899;
double r81908 = r81906 * r81907;
double r81909 = 4.0;
double r81910 = pow(r81905, r81909);
double r81911 = pow(r81899, r81909);
double r81912 = r81910 - r81911;
double r81913 = r81907 * r81906;
double r81914 = r81912 / r81913;
double r81915 = r81908 / r81914;
double r81916 = -4.0022056602069904e-171;
bool r81917 = r81899 <= r81916;
double r81918 = 2.2457907428295544e-222;
bool r81919 = r81899 <= r81918;
double r81920 = 1.0;
double r81921 = 5.875513051791536e-203;
bool r81922 = r81899 <= r81921;
double r81923 = 8.954732963342978e-75;
bool r81924 = r81899 <= r81923;
double r81925 = r81924 ? r81920 : r81915;
double r81926 = r81922 ? r81902 : r81925;
double r81927 = r81919 ? r81920 : r81926;
double r81928 = r81917 ? r81902 : r81927;
double r81929 = r81904 ? r81915 : r81928;
double r81930 = r81901 ? r81902 : r81929;
return r81930;
}




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))))