\frac{x \cdot x - \left(y \cdot 4.0\right) \cdot y}{x \cdot x + \left(y \cdot 4.0\right) \cdot y}\begin{array}{l}
\mathbf{if}\;x \cdot x \le 7.1088010196971 \cdot 10^{-314}:\\
\;\;\;\;-1.0\\
\mathbf{elif}\;x \cdot x \le 9.758857908001147 \cdot 10^{+18}:\\
\;\;\;\;\frac{1}{\frac{y \cdot \left(4.0 \cdot y\right) + x \cdot x}{x \cdot x - y \cdot \left(4.0 \cdot y\right)}}\\
\mathbf{elif}\;x \cdot x \le 6.296502919195928 \cdot 10^{+44}:\\
\;\;\;\;-1.0\\
\mathbf{elif}\;x \cdot x \le 3.1031769081973586 \cdot 10^{+257}:\\
\;\;\;\;\frac{1}{\frac{y \cdot \left(4.0 \cdot y\right) + x \cdot x}{x \cdot x - y \cdot \left(4.0 \cdot y\right)}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r18045397 = x;
double r18045398 = r18045397 * r18045397;
double r18045399 = y;
double r18045400 = 4.0;
double r18045401 = r18045399 * r18045400;
double r18045402 = r18045401 * r18045399;
double r18045403 = r18045398 - r18045402;
double r18045404 = r18045398 + r18045402;
double r18045405 = r18045403 / r18045404;
return r18045405;
}
double f(double x, double y) {
double r18045406 = x;
double r18045407 = r18045406 * r18045406;
double r18045408 = 7.1088010196971e-314;
bool r18045409 = r18045407 <= r18045408;
double r18045410 = -1.0;
double r18045411 = 9.758857908001147e+18;
bool r18045412 = r18045407 <= r18045411;
double r18045413 = 1.0;
double r18045414 = y;
double r18045415 = 4.0;
double r18045416 = r18045415 * r18045414;
double r18045417 = r18045414 * r18045416;
double r18045418 = r18045417 + r18045407;
double r18045419 = r18045407 - r18045417;
double r18045420 = r18045418 / r18045419;
double r18045421 = r18045413 / r18045420;
double r18045422 = 6.296502919195928e+44;
bool r18045423 = r18045407 <= r18045422;
double r18045424 = 3.1031769081973586e+257;
bool r18045425 = r18045407 <= r18045424;
double r18045426 = r18045425 ? r18045421 : r18045413;
double r18045427 = r18045423 ? r18045410 : r18045426;
double r18045428 = r18045412 ? r18045421 : r18045427;
double r18045429 = r18045409 ? r18045410 : r18045428;
return r18045429;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.1 |
|---|---|
| Target | 31.2 |
| Herbie | 12.6 |
if (* x x) < 7.1088010196971e-314 or 9.758857908001147e+18 < (* x x) < 6.296502919195928e+44Initial program 29.3
Taylor expanded around 0 10.1
if 7.1088010196971e-314 < (* x x) < 9.758857908001147e+18 or 6.296502919195928e+44 < (* x x) < 3.1031769081973586e+257Initial program 16.1
rmApplied clear-num16.1
if 3.1031769081973586e+257 < (* x x) Initial program 56.4
Taylor expanded around inf 9.6
Final simplification12.6
herbie shell --seed 2019163 +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) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))