\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -4.1441462901281477 \cdot 10^{145}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -3.5207833304409473 \cdot 10^{-162}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\right)}^{3}}\\
\mathbf{elif}\;y \le 3.6600809160932306 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\right)}^{3}}\\
\end{array}double code(double x, double y) {
return ((double) (((double) (((double) (x - y)) * ((double) (x + y)))) / ((double) (((double) (x * x)) + ((double) (y * y))))));
}
double code(double x, double y) {
double VAR;
if ((y <= -4.1441462901281477e+145)) {
VAR = -1.0;
} else {
double VAR_1;
if ((y <= -3.5207833304409473e-162)) {
VAR_1 = ((double) cbrt(((double) pow(((double) (((double) (((double) (x - y)) * ((double) (x + y)))) / ((double) (((double) (x * x)) + ((double) (y * y)))))), 3.0))));
} else {
double VAR_2;
if ((y <= 3.6600809160932306e-162)) {
VAR_2 = 1.0;
} else {
VAR_2 = ((double) cbrt(((double) pow(((double) (((double) (((double) (x - y)) * ((double) (x + y)))) / ((double) (((double) (x * x)) + ((double) (y * y)))))), 3.0))));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.9 |
|---|---|
| Target | 0.0 |
| Herbie | 5.3 |
if y < -4.1441462901281477e+145Initial program 60.7
Taylor expanded around 0 0
if -4.1441462901281477e+145 < y < -3.5207833304409473e-162 or 3.6600809160932306e-162 < y Initial program 0.0
rmApplied add-cbrt-cube37.4
Applied add-cbrt-cube37.6
Applied add-cbrt-cube37.8
Applied cbrt-unprod37.4
Applied cbrt-undiv37.3
Simplified0.0
if -3.5207833304409473e-162 < y < 3.6600809160932306e-162Initial program 30.5
Taylor expanded around inf 16.2
Final simplification5.3
herbie shell --seed 2020130
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (< 0.0 x 1.0) (< y 1.0))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2.0) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))