\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\begin{array}{l}
\mathbf{if}\;x \cdot x \le 1.376122509742530877543344174301183479676 \cdot 10^{-251}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 2.285582852365793226651820472382056127268 \cdot 10^{-180}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + \left(y \cdot 4\right) \cdot y} - \frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;x \cdot x \le 1.220088560819746934993661344775764994096 \cdot 10^{-131}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 6.180077099071456665238677691645979687927 \cdot 10^{191}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + \left(y \cdot 4\right) \cdot y} - \frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r440325 = x;
double r440326 = r440325 * r440325;
double r440327 = y;
double r440328 = 4.0;
double r440329 = r440327 * r440328;
double r440330 = r440329 * r440327;
double r440331 = r440326 - r440330;
double r440332 = r440326 + r440330;
double r440333 = r440331 / r440332;
return r440333;
}
double f(double x, double y) {
double r440334 = x;
double r440335 = r440334 * r440334;
double r440336 = 1.3761225097425309e-251;
bool r440337 = r440335 <= r440336;
double r440338 = -1.0;
double r440339 = 2.2855828523657932e-180;
bool r440340 = r440335 <= r440339;
double r440341 = y;
double r440342 = 4.0;
double r440343 = r440341 * r440342;
double r440344 = r440343 * r440341;
double r440345 = r440335 + r440344;
double r440346 = r440335 / r440345;
double r440347 = r440344 / r440345;
double r440348 = r440346 - r440347;
double r440349 = 1.220088560819747e-131;
bool r440350 = r440335 <= r440349;
double r440351 = 6.180077099071457e+191;
bool r440352 = r440335 <= r440351;
double r440353 = 1.0;
double r440354 = r440352 ? r440348 : r440353;
double r440355 = r440350 ? r440338 : r440354;
double r440356 = r440340 ? r440348 : r440355;
double r440357 = r440337 ? r440338 : r440356;
return r440357;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.8 |
|---|---|
| Target | 31.5 |
| Herbie | 12.7 |
if (* x x) < 1.3761225097425309e-251 or 2.2855828523657932e-180 < (* x x) < 1.220088560819747e-131Initial program 27.4
Taylor expanded around 0 10.5
if 1.3761225097425309e-251 < (* x x) < 2.2855828523657932e-180 or 1.220088560819747e-131 < (* x x) < 6.180077099071457e+191Initial program 16.3
rmApplied div-sub16.3
if 6.180077099071457e+191 < (* x x) Initial program 50.7
Taylor expanded around inf 11.5
Final simplification12.7
herbie shell --seed 2019298
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< (/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))) 0.974323384962678118) (- (/ (* x x) (+ (* x x) (* (* y y) 4))) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4)))) 2) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))))
(/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))))