\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 \cdot \left(y \cdot 4\right) \le 7.027808530107358188452156248527074599726 \cdot 10^{-286}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \cdot \left(y \cdot 4\right) \le 3.69166379221494303097062696142672714528 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}\right)\right)\\
\mathbf{elif}\;y \cdot \left(y \cdot 4\right) \le 1.792267162890288236819749793630475002654 \cdot 10^{85}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \cdot \left(y \cdot 4\right) \le 8.170638210533042102915317867916107400746 \cdot 10^{248}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}\right)\right)\\
\mathbf{elif}\;y \cdot \left(y \cdot 4\right) \le 1.496258465901378664026516368495157364812 \cdot 10^{262}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r31215464 = x;
double r31215465 = r31215464 * r31215464;
double r31215466 = y;
double r31215467 = 4.0;
double r31215468 = r31215466 * r31215467;
double r31215469 = r31215468 * r31215466;
double r31215470 = r31215465 - r31215469;
double r31215471 = r31215465 + r31215469;
double r31215472 = r31215470 / r31215471;
return r31215472;
}
double f(double x, double y) {
double r31215473 = y;
double r31215474 = 4.0;
double r31215475 = r31215473 * r31215474;
double r31215476 = r31215473 * r31215475;
double r31215477 = 7.027808530107358e-286;
bool r31215478 = r31215476 <= r31215477;
double r31215479 = 1.0;
double r31215480 = 3.691663792214943e-13;
bool r31215481 = r31215476 <= r31215480;
double r31215482 = x;
double r31215483 = r31215482 * r31215482;
double r31215484 = r31215483 - r31215476;
double r31215485 = fma(r31215482, r31215482, r31215476);
double r31215486 = r31215484 / r31215485;
double r31215487 = expm1(r31215486);
double r31215488 = log1p(r31215487);
double r31215489 = 1.7922671628902882e+85;
bool r31215490 = r31215476 <= r31215489;
double r31215491 = 8.170638210533042e+248;
bool r31215492 = r31215476 <= r31215491;
double r31215493 = 1.4962584659013787e+262;
bool r31215494 = r31215476 <= r31215493;
double r31215495 = -1.0;
double r31215496 = r31215494 ? r31215479 : r31215495;
double r31215497 = r31215492 ? r31215488 : r31215496;
double r31215498 = r31215490 ? r31215479 : r31215497;
double r31215499 = r31215481 ? r31215488 : r31215498;
double r31215500 = r31215478 ? r31215479 : r31215499;
return r31215500;
}




Bits error versus x




Bits error versus y
| Original | 31.6 |
|---|---|
| Target | 31.3 |
| Herbie | 13.4 |
if (* (* y 4.0) y) < 7.027808530107358e-286 or 3.691663792214943e-13 < (* (* y 4.0) y) < 1.7922671628902882e+85 or 8.170638210533042e+248 < (* (* y 4.0) y) < 1.4962584659013787e+262Initial program 26.5
Taylor expanded around inf 15.0
if 7.027808530107358e-286 < (* (* y 4.0) y) < 3.691663792214943e-13 or 1.7922671628902882e+85 < (* (* y 4.0) y) < 8.170638210533042e+248Initial program 15.2
rmApplied fma-def15.2
rmApplied log1p-expm1-u15.2
if 1.4962584659013787e+262 < (* (* y 4.0) y) Initial program 57.7
Taylor expanded around 0 9.1
Final simplification13.4
herbie shell --seed 2019192 +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))))