\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.5004990530179034 \cdot 10^{152}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -1.3929248153997159 \cdot 10^{-162}:\\
\;\;\;\;\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, \frac{{x}^{2}}{y}\right)}\\
\mathbf{elif}\;x \le 8.39893520792411963 \cdot 10^{-184}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 1.34095967395193592 \cdot 10^{153}:\\
\;\;\;\;\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, \frac{{x}^{2}}{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r647329 = x;
double r647330 = r647329 * r647329;
double r647331 = y;
double r647332 = 4.0;
double r647333 = r647331 * r647332;
double r647334 = r647333 * r647331;
double r647335 = r647330 - r647334;
double r647336 = r647330 + r647334;
double r647337 = r647335 / r647336;
return r647337;
}
double f(double x, double y) {
double r647338 = x;
double r647339 = -1.5004990530179034e+152;
bool r647340 = r647338 <= r647339;
double r647341 = 1.0;
double r647342 = -1.3929248153997159e-162;
bool r647343 = r647338 <= r647342;
double r647344 = y;
double r647345 = 4.0;
double r647346 = r647344 * r647345;
double r647347 = r647346 * r647344;
double r647348 = fma(r647338, r647338, r647347);
double r647349 = r647348 / r647338;
double r647350 = r647338 / r647349;
double r647351 = 2.0;
double r647352 = pow(r647338, r647351);
double r647353 = r647352 / r647344;
double r647354 = fma(r647345, r647344, r647353);
double r647355 = r647346 / r647354;
double r647356 = r647350 - r647355;
double r647357 = 8.39893520792412e-184;
bool r647358 = r647338 <= r647357;
double r647359 = -1.0;
double r647360 = 1.340959673951936e+153;
bool r647361 = r647338 <= r647360;
double r647362 = r647361 ? r647356 : r647341;
double r647363 = r647358 ? r647359 : r647362;
double r647364 = r647343 ? r647356 : r647363;
double r647365 = r647340 ? r647341 : r647364;
return r647365;
}




Bits error versus x




Bits error versus y
| Original | 31.3 |
|---|---|
| Target | 31.0 |
| Herbie | 4.0 |
if x < -1.5004990530179034e+152 or 1.340959673951936e+153 < x Initial program 63.5
Taylor expanded around inf 8.5
if -1.5004990530179034e+152 < x < -1.3929248153997159e-162 or 8.39893520792412e-184 < x < 1.340959673951936e+153Initial program 15.9
rmApplied div-sub15.9
Simplified16.0
Simplified15.6
Taylor expanded around 0 0.6
Simplified0.6
if -1.3929248153997159e-162 < x < 8.39893520792412e-184Initial program 31.6
Taylor expanded around 0 7.4
Final simplification4.0
herbie shell --seed 2020065 +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))))