\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 -1.15431295039553488213566106957485115951 \cdot 10^{123}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -1.049461047373995695414776940334688667457 \cdot 10^{-90}:\\
\;\;\;\;\frac{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\sqrt{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}}{\sqrt{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\\
\mathbf{elif}\;x \le 5.481288829847034474742950694868171684444 \cdot 10^{-119}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 7.251238886375513779793874451315946152856 \cdot 10^{-42}:\\
\;\;\;\;\frac{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\sqrt{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}}{\sqrt{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\\
\mathbf{elif}\;x \le 2.637073173922210812467059604102814773796 \cdot 10^{-4}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 4.73515077677864244964006142406283884833 \cdot 10^{127}:\\
\;\;\;\;\frac{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\sqrt{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}}{\sqrt{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r511295 = x;
double r511296 = r511295 * r511295;
double r511297 = y;
double r511298 = 4.0;
double r511299 = r511297 * r511298;
double r511300 = r511299 * r511297;
double r511301 = r511296 - r511300;
double r511302 = r511296 + r511300;
double r511303 = r511301 / r511302;
return r511303;
}
double f(double x, double y) {
double r511304 = x;
double r511305 = -1.1543129503955349e+123;
bool r511306 = r511304 <= r511305;
double r511307 = 1.0;
double r511308 = -1.0494610473739957e-90;
bool r511309 = r511304 <= r511308;
double r511310 = r511304 * r511304;
double r511311 = y;
double r511312 = 4.0;
double r511313 = r511311 * r511312;
double r511314 = r511313 * r511311;
double r511315 = r511310 - r511314;
double r511316 = fma(r511304, r511304, r511314);
double r511317 = sqrt(r511316);
double r511318 = r511315 / r511317;
double r511319 = r511318 / r511317;
double r511320 = 5.481288829847034e-119;
bool r511321 = r511304 <= r511320;
double r511322 = -1.0;
double r511323 = 7.251238886375514e-42;
bool r511324 = r511304 <= r511323;
double r511325 = 0.0002637073173922211;
bool r511326 = r511304 <= r511325;
double r511327 = 4.735150776778642e+127;
bool r511328 = r511304 <= r511327;
double r511329 = r511328 ? r511319 : r511307;
double r511330 = r511326 ? r511322 : r511329;
double r511331 = r511324 ? r511319 : r511330;
double r511332 = r511321 ? r511322 : r511331;
double r511333 = r511309 ? r511319 : r511332;
double r511334 = r511306 ? r511307 : r511333;
return r511334;
}




Bits error versus x




Bits error versus y
| Original | 32.0 |
|---|---|
| Target | 31.8 |
| Herbie | 12.6 |
if x < -1.1543129503955349e+123 or 4.735150776778642e+127 < x Initial program 56.5
Simplified56.5
Taylor expanded around inf 9.8
if -1.1543129503955349e+123 < x < -1.0494610473739957e-90 or 5.481288829847034e-119 < x < 7.251238886375514e-42 or 0.0002637073173922211 < x < 4.735150776778642e+127Initial program 15.7
Simplified15.7
rmApplied add-sqr-sqrt15.7
Applied associate-/r*15.8
if -1.0494610473739957e-90 < x < 5.481288829847034e-119 or 7.251238886375514e-42 < x < 0.0002637073173922211Initial program 26.5
Simplified26.5
Taylor expanded around 0 12.2
Final simplification12.6
herbie shell --seed 2019212 +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.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))))