\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}\;y \le -1.302473734361689583818414967767065647429 \cdot 10^{64}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 4.427972959141087508327226963770083374106 \cdot 10^{-125}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 4.117086201251834897728735635968684829902 \cdot 10^{60}:\\
\;\;\;\;\log \left(e^{\frac{x \cdot x - y \cdot \left(4 \cdot y\right)}{x \cdot x + y \cdot \left(4 \cdot y\right)}}\right)\\
\mathbf{elif}\;y \le 5.419438360639095008822556977586250635758 \cdot 10^{72}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 1.027562094282635282760369761847330220115 \cdot 10^{103}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x \cdot x}{\mathsf{fma}\left(4 \cdot y, y, x \cdot x\right)} - \frac{4 \cdot y}{\mathsf{fma}\left(4 \cdot y, y, x \cdot x\right)} \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r32653569 = x;
double r32653570 = r32653569 * r32653569;
double r32653571 = y;
double r32653572 = 4.0;
double r32653573 = r32653571 * r32653572;
double r32653574 = r32653573 * r32653571;
double r32653575 = r32653570 - r32653574;
double r32653576 = r32653570 + r32653574;
double r32653577 = r32653575 / r32653576;
return r32653577;
}
double f(double x, double y) {
double r32653578 = y;
double r32653579 = -1.3024737343616896e+64;
bool r32653580 = r32653578 <= r32653579;
double r32653581 = -1.0;
double r32653582 = 4.4279729591410875e-125;
bool r32653583 = r32653578 <= r32653582;
double r32653584 = 1.0;
double r32653585 = 4.117086201251835e+60;
bool r32653586 = r32653578 <= r32653585;
double r32653587 = x;
double r32653588 = r32653587 * r32653587;
double r32653589 = 4.0;
double r32653590 = r32653589 * r32653578;
double r32653591 = r32653578 * r32653590;
double r32653592 = r32653588 - r32653591;
double r32653593 = r32653588 + r32653591;
double r32653594 = r32653592 / r32653593;
double r32653595 = exp(r32653594);
double r32653596 = log(r32653595);
double r32653597 = 5.419438360639095e+72;
bool r32653598 = r32653578 <= r32653597;
double r32653599 = 1.0275620942826353e+103;
bool r32653600 = r32653578 <= r32653599;
double r32653601 = fma(r32653590, r32653578, r32653588);
double r32653602 = r32653588 / r32653601;
double r32653603 = r32653590 / r32653601;
double r32653604 = r32653603 * r32653578;
double r32653605 = r32653602 - r32653604;
double r32653606 = expm1(r32653605);
double r32653607 = log1p(r32653606);
double r32653608 = r32653600 ? r32653607 : r32653581;
double r32653609 = r32653598 ? r32653584 : r32653608;
double r32653610 = r32653586 ? r32653596 : r32653609;
double r32653611 = r32653583 ? r32653584 : r32653610;
double r32653612 = r32653580 ? r32653581 : r32653611;
return r32653612;
}




Bits error versus x




Bits error versus y
| Original | 31.7 |
|---|---|
| Target | 31.4 |
| Herbie | 14.8 |
if y < -1.3024737343616896e+64 or 1.0275620942826353e+103 < y Initial program 48.8
Taylor expanded around 0 12.0
if -1.3024737343616896e+64 < y < 4.4279729591410875e-125 or 4.117086201251835e+60 < y < 5.419438360639095e+72Initial program 24.5
Taylor expanded around inf 16.4
if 4.4279729591410875e-125 < y < 4.117086201251835e+60Initial program 16.0
rmApplied add-log-exp16.0
if 5.419438360639095e+72 < y < 1.0275620942826353e+103Initial program 18.2
rmApplied add-log-exp18.2
rmApplied log1p-expm1-u18.2
Simplified18.3
Final simplification14.8
herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:herbie-target
(if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))