\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}\;\left(y \cdot 4\right) \cdot y \le 1.6369934943455741 \cdot 10^{-236}:\\
\;\;\;\;\log \left(e^{1}\right)\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 5.67683447431044356 \cdot 10^{-195}:\\
\;\;\;\;\log \left(\sqrt{e^{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \cdot \sqrt{e^{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}}\right)\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 4.59799826269274119 \cdot 10^{-107}:\\
\;\;\;\;\log \left(e^{1}\right)\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 2.0411044840266384 \cdot 10^{-43}:\\
\;\;\;\;\log \left(\sqrt{e^{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \cdot \sqrt{e^{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}}\right)\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 1.21092149843973852 \cdot 10^{30}:\\
\;\;\;\;\log \left(e^{1}\right)\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 1.4934131972492307 \cdot 10^{149}:\\
\;\;\;\;\log \left(\sqrt{e^{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \cdot \sqrt{e^{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{-1}\right)\\
\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 ((((y * 4.0) * y) <= 1.636993494345574e-236)) {
temp = log(exp(1.0));
} else {
double temp_1;
if ((((y * 4.0) * y) <= 5.6768344743104436e-195)) {
temp_1 = log((sqrt(exp((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y))))) * sqrt(exp((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)))))));
} else {
double temp_2;
if ((((y * 4.0) * y) <= 4.597998262692741e-107)) {
temp_2 = log(exp(1.0));
} else {
double temp_3;
if ((((y * 4.0) * y) <= 2.0411044840266384e-43)) {
temp_3 = log((sqrt(exp((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y))))) * sqrt(exp((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)))))));
} else {
double temp_4;
if ((((y * 4.0) * y) <= 1.2109214984397385e+30)) {
temp_4 = log(exp(1.0));
} else {
double temp_5;
if ((((y * 4.0) * y) <= 1.4934131972492307e+149)) {
temp_5 = log((sqrt(exp((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y))))) * sqrt(exp((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)))))));
} else {
temp_5 = log(exp(-1.0));
}
temp_4 = temp_5;
}
temp_3 = temp_4;
}
temp_2 = temp_3;
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.5 |
|---|---|
| Target | 31.3 |
| Herbie | 13.9 |
if (* (* y 4.0) y) < 1.636993494345574e-236 or 5.6768344743104436e-195 < (* (* y 4.0) y) < 4.597998262692741e-107 or 2.0411044840266384e-43 < (* (* y 4.0) y) < 1.2109214984397385e+30Initial program 24.2
rmApplied add-log-exp24.2
Taylor expanded around inf 15.3
if 1.636993494345574e-236 < (* (* y 4.0) y) < 5.6768344743104436e-195 or 4.597998262692741e-107 < (* (* y 4.0) y) < 2.0411044840266384e-43 or 1.2109214984397385e+30 < (* (* y 4.0) y) < 1.4934131972492307e+149Initial program 14.7
rmApplied add-log-exp14.7
rmApplied add-sqr-sqrt14.7
if 1.4934131972492307e+149 < (* (* y 4.0) y) Initial program 48.1
rmApplied add-log-exp48.1
Taylor expanded around 0 11.8
Final simplification13.9
herbie shell --seed 2020053
(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))))