\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 \cdot x \le 6.3797542974604777 \cdot 10^{-150}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 1.36543813309785343 \cdot 10^{125}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{x \cdot x}{x \cdot x + \left(y \cdot 4\right) \cdot y}\right)}^{3}} - \frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double code(double x, double y) {
return (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
}
double code(double x, double y) {
double temp;
if (((x * x) <= 6.379754297460478e-150)) {
temp = -1.0;
} else {
double temp_1;
if (((x * x) <= 1.3654381330978534e+125)) {
temp_1 = (cbrt(pow(((x * x) / ((x * x) + ((y * 4.0) * y))), 3.0)) - (((y * 4.0) * y) / ((x * x) + ((y * 4.0) * y))));
} else {
temp_1 = 1.0;
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 31.4 |
| Herbie | 13.5 |
if (* x x) < 6.379754297460478e-150Initial program 26.0
Taylor expanded around 0 12.3
if 6.379754297460478e-150 < (* x x) < 1.3654381330978534e+125Initial program 16.8
rmApplied div-sub16.8
rmApplied add-cbrt-cube24.2
Applied add-cbrt-cube24.3
Applied add-cbrt-cube24.4
Applied cbrt-unprod24.6
Applied cbrt-undiv24.5
Simplified16.8
if 1.3654381330978534e+125 < (* x x) Initial program 46.0
Taylor expanded around inf 12.7
Final simplification13.5
herbie shell --seed 2020057
(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))))