\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 \leq -9.789826550149937 \cdot 10^{+63}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -2.0670216515310263 \cdot 10^{+33}:\\
\;\;\;\;-1 + 0.5 \cdot \frac{x \cdot x}{y \cdot y}\\
\mathbf{elif}\;x \leq -1.1530864834412767 \cdot 10^{-108}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + y \cdot \left(y \cdot 4\right)} - \frac{y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{elif}\;x \leq 2.5574576931355925 \cdot 10^{-114}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 2.3500817544996674 \cdot 10^{+80}:\\
\;\;\;\;\log \left(e^{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}}\right)\\
\mathbf{elif}\;x \leq 3.5779591776205156 \cdot 10^{+94}:\\
\;\;\;\;-1 + 0.5 \cdot \frac{x \cdot x}{y \cdot y}\\
\mathbf{elif}\;x \leq 5.789054045437359 \cdot 10^{+121}:\\
\;\;\;\;\sqrt[3]{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}} \cdot \left(\sqrt[3]{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}} \cdot \sqrt[3]{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}(FPCore (x y) :precision binary64 (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))
(FPCore (x y)
:precision binary64
(if (<= x -9.789826550149937e+63)
1.0
(if (<= x -2.0670216515310263e+33)
(+ -1.0 (* 0.5 (/ (* x x) (* y y))))
(if (<= x -1.1530864834412767e-108)
(-
(/ (* x x) (+ (* x x) (* y (* y 4.0))))
(/ (* y (* y 4.0)) (+ (* x x) (* y (* y 4.0)))))
(if (<= x 2.5574576931355925e-114)
-1.0
(if (<= x 2.3500817544996674e+80)
(log
(exp (/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0))))))
(if (<= x 3.5779591776205156e+94)
(+ -1.0 (* 0.5 (/ (* x x) (* y y))))
(if (<= x 5.789054045437359e+121)
(*
(cbrt
(/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0)))))
(*
(cbrt
(/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0)))))
(cbrt
(/
(- (* x x) (* y (* y 4.0)))
(+ (* x x) (* y (* y 4.0)))))))
1.0))))))))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 tmp;
if (x <= -9.789826550149937e+63) {
tmp = 1.0;
} else if (x <= -2.0670216515310263e+33) {
tmp = -1.0 + (0.5 * ((x * x) / (y * y)));
} else if (x <= -1.1530864834412767e-108) {
tmp = ((x * x) / ((x * x) + (y * (y * 4.0)))) - ((y * (y * 4.0)) / ((x * x) + (y * (y * 4.0))));
} else if (x <= 2.5574576931355925e-114) {
tmp = -1.0;
} else if (x <= 2.3500817544996674e+80) {
tmp = log(exp(((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)))));
} else if (x <= 3.5779591776205156e+94) {
tmp = -1.0 + (0.5 * ((x * x) / (y * y)));
} else if (x <= 5.789054045437359e+121) {
tmp = cbrt(((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)))) * (cbrt(((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)))) * cbrt(((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)))));
} else {
tmp = 1.0;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 32.1 |
|---|---|
| Target | 31.8 |
| Herbie | 13.1 |
if x < -9.789826550149937e63 or 5.7890540454373593e121 < x Initial program 50.8
rmApplied add-log-exp_binary64_1000650.8
Simplified50.8
Taylor expanded around inf 11.4
if -9.789826550149937e63 < x < -2.06702165153102634e33 or 2.3500817544996674e80 < x < 3.57795917762051556e94Initial program 20.4
Taylor expanded around 0 34.7
Simplified34.7
if -2.06702165153102634e33 < x < -1.15308648344127671e-108Initial program 17.1
rmApplied div-sub_binary64_997217.1
if -1.15308648344127671e-108 < x < 2.5574576931355925e-114Initial program 27.4
rmApplied add-log-exp_binary64_1000627.4
Simplified27.4
Taylor expanded around 0 9.8
Simplified9.8
if 2.5574576931355925e-114 < x < 2.3500817544996674e80Initial program 15.6
rmApplied add-log-exp_binary64_1000615.6
if 3.57795917762051556e94 < x < 5.7890540454373593e121Initial program 15.8
rmApplied add-cube-cbrt_binary64_1000215.8
Final simplification13.1
herbie shell --seed 2021096
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))