\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}\;x \le -5.29734148790873495 \cdot 10^{156}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le 1.3249836726640813 \cdot 10^{154}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\mathsf{fma}\left(4, y, x \cdot \frac{x}{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r602290 = x;
double r602291 = r602290 * r602290;
double r602292 = y;
double r602293 = 4.0;
double r602294 = r602292 * r602293;
double r602295 = r602294 * r602292;
double r602296 = r602291 - r602295;
double r602297 = r602291 + r602295;
double r602298 = r602296 / r602297;
return r602298;
}
double f(double x, double y) {
double r602299 = x;
double r602300 = -5.297341487908735e+156;
bool r602301 = r602299 <= r602300;
double r602302 = 1.0;
double r602303 = 1.3249836726640813e+154;
bool r602304 = r602299 <= r602303;
double r602305 = y;
double r602306 = 4.0;
double r602307 = r602305 * r602306;
double r602308 = r602307 * r602305;
double r602309 = fma(r602299, r602299, r602308);
double r602310 = r602309 / r602299;
double r602311 = r602299 / r602310;
double r602312 = r602299 / r602305;
double r602313 = r602299 * r602312;
double r602314 = fma(r602306, r602305, r602313);
double r602315 = r602307 / r602314;
double r602316 = r602311 - r602315;
double r602317 = r602304 ? r602316 : r602302;
double r602318 = r602301 ? r602302 : r602317;
return r602318;
}




Bits error versus x




Bits error versus y
| Original | 32.1 |
|---|---|
| Target | 31.8 |
| Herbie | 5.7 |
if x < -5.297341487908735e+156 or 1.3249836726640813e+154 < x Initial program 64.0
Taylor expanded around inf 8.3
if -5.297341487908735e+156 < x < 1.3249836726640813e+154Initial program 21.2
rmApplied div-sub21.2
Simplified21.3
Simplified21.0
Taylor expanded around 0 4.9
Simplified4.9
rmApplied *-un-lft-identity4.9
Applied add-sqr-sqrt34.3
Applied unpow-prod-down34.3
Applied times-frac34.3
Simplified34.3
Simplified4.8
Final simplification5.7
herbie shell --seed 2020033 +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))))