\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}\;\left(y \cdot 4\right) \cdot y \le 1.883987095627688634773256576903935146579 \cdot 10^{-179}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 25951328951665387827625984:\\
\;\;\;\;\left(\sqrt[3]{\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \cdot \sqrt[3]{\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\right) \cdot \sqrt[3]{\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 56309717854388472133950898176:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 7.251271519567312889559392701775878259286 \cdot 10^{285}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \sqrt[3]{{\left(\frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\right)}^{3}}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r443274 = x;
double r443275 = r443274 * r443274;
double r443276 = y;
double r443277 = 4.0;
double r443278 = r443276 * r443277;
double r443279 = r443278 * r443276;
double r443280 = r443275 - r443279;
double r443281 = r443275 + r443279;
double r443282 = r443280 / r443281;
return r443282;
}
double f(double x, double y) {
double r443283 = y;
double r443284 = 4.0;
double r443285 = r443283 * r443284;
double r443286 = r443285 * r443283;
double r443287 = 1.8839870956276886e-179;
bool r443288 = r443286 <= r443287;
double r443289 = 1.0;
double r443290 = 2.5951328951665388e+25;
bool r443291 = r443286 <= r443290;
double r443292 = x;
double r443293 = r443292 * r443292;
double r443294 = fma(r443292, r443292, r443286);
double r443295 = r443293 / r443294;
double r443296 = r443286 / r443294;
double r443297 = r443295 - r443296;
double r443298 = cbrt(r443297);
double r443299 = r443298 * r443298;
double r443300 = r443299 * r443298;
double r443301 = 5.630971785438847e+28;
bool r443302 = r443286 <= r443301;
double r443303 = 7.251271519567313e+285;
bool r443304 = r443286 <= r443303;
double r443305 = 3.0;
double r443306 = pow(r443296, r443305);
double r443307 = cbrt(r443306);
double r443308 = r443295 - r443307;
double r443309 = -1.0;
double r443310 = r443304 ? r443308 : r443309;
double r443311 = r443302 ? r443289 : r443310;
double r443312 = r443291 ? r443300 : r443311;
double r443313 = r443288 ? r443289 : r443312;
return r443313;
}




Bits error versus x




Bits error versus y
| Original | 31.7 |
|---|---|
| Target | 31.4 |
| Herbie | 12.4 |
if (* (* y 4.0) y) < 1.8839870956276886e-179 or 2.5951328951665388e+25 < (* (* y 4.0) y) < 5.630971785438847e+28Initial program 26.3
Simplified26.3
Taylor expanded around inf 11.7
if 1.8839870956276886e-179 < (* (* y 4.0) y) < 2.5951328951665388e+25Initial program 16.4
Simplified16.4
rmApplied div-sub16.4
rmApplied add-cube-cbrt16.4
if 5.630971785438847e+28 < (* (* y 4.0) y) < 7.251271519567313e+285Initial program 15.2
Simplified15.2
rmApplied div-sub15.2
rmApplied add-cbrt-cube44.2
Applied add-cbrt-cube45.8
Applied add-cbrt-cube45.8
Applied add-cbrt-cube45.8
Applied cbrt-unprod45.9
Applied cbrt-unprod49.3
Applied cbrt-undiv49.3
Simplified15.2
if 7.251271519567313e+285 < (* (* y 4.0) y) Initial program 61.2
Simplified61.2
Taylor expanded around 0 8.9
Final simplification12.4
herbie shell --seed 2019323 +o rules:numerics
(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.9743233849626781) (- (/ (* 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))))