\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 5.718768288099246126312041584088080456012 \cdot 10^{-268}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 1.241501134612847185668163104964911594951 \cdot 10^{-113}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + \left(y \cdot 4\right) \cdot y} - \log \left(e^{\frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}\right)\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 1.271956599507589364867198384904507725067 \cdot 10^{-56}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 2.388808225827260431194217502349927164749 \cdot 10^{175}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + \left(y \cdot 4\right) \cdot y} - \log \left(e^{\frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r541485 = x;
double r541486 = r541485 * r541485;
double r541487 = y;
double r541488 = 4.0;
double r541489 = r541487 * r541488;
double r541490 = r541489 * r541487;
double r541491 = r541486 - r541490;
double r541492 = r541486 + r541490;
double r541493 = r541491 / r541492;
return r541493;
}
double f(double x, double y) {
double r541494 = y;
double r541495 = 4.0;
double r541496 = r541494 * r541495;
double r541497 = r541496 * r541494;
double r541498 = 5.718768288099246e-268;
bool r541499 = r541497 <= r541498;
double r541500 = 1.0;
double r541501 = 1.2415011346128472e-113;
bool r541502 = r541497 <= r541501;
double r541503 = x;
double r541504 = r541503 * r541503;
double r541505 = r541504 + r541497;
double r541506 = r541504 / r541505;
double r541507 = r541497 / r541505;
double r541508 = exp(r541507);
double r541509 = log(r541508);
double r541510 = r541506 - r541509;
double r541511 = 1.2719565995075894e-56;
bool r541512 = r541497 <= r541511;
double r541513 = 2.3888082258272604e+175;
bool r541514 = r541497 <= r541513;
double r541515 = 1.0;
double r541516 = -r541515;
double r541517 = r541514 ? r541510 : r541516;
double r541518 = r541512 ? r541500 : r541517;
double r541519 = r541502 ? r541510 : r541518;
double r541520 = r541499 ? r541500 : r541519;
return r541520;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.6 |
|---|---|
| Target | 31.3 |
| Herbie | 12.7 |
if (* (* y 4.0) y) < 5.718768288099246e-268 or 1.2415011346128472e-113 < (* (* y 4.0) y) < 1.2719565995075894e-56Initial program 26.3
Taylor expanded around inf 11.6
if 5.718768288099246e-268 < (* (* y 4.0) y) < 1.2415011346128472e-113 or 1.2719565995075894e-56 < (* (* y 4.0) y) < 2.3888082258272604e+175Initial program 15.7
rmApplied div-sub15.7
rmApplied add-log-exp15.7
if 2.3888082258272604e+175 < (* (* y 4.0) y) Initial program 49.9
rmApplied div-sub49.9
rmApplied add-log-exp49.9
Taylor expanded around 0 11.4
Final simplification12.7
herbie shell --seed 2019208
(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))))