\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 1.04662384361210072 \cdot 10^{-202}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 1.3005275433696336 \cdot 10^{250}:\\
\;\;\;\;\log \left(\frac{e^{\frac{x}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{x}}}}{e^{\frac{y \cdot 4}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{y}}}}\right)\\
\mathbf{elif}\;x \cdot x \le 2.97717800904674578 \cdot 10^{272}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r597119 = x;
double r597120 = r597119 * r597119;
double r597121 = y;
double r597122 = 4.0;
double r597123 = r597121 * r597122;
double r597124 = r597123 * r597121;
double r597125 = r597120 - r597124;
double r597126 = r597120 + r597124;
double r597127 = r597125 / r597126;
return r597127;
}
double f(double x, double y) {
double r597128 = x;
double r597129 = r597128 * r597128;
double r597130 = 1.0466238436121007e-202;
bool r597131 = r597129 <= r597130;
double r597132 = -1.0;
double r597133 = 1.3005275433696336e+250;
bool r597134 = r597129 <= r597133;
double r597135 = y;
double r597136 = 4.0;
double r597137 = r597135 * r597136;
double r597138 = r597137 * r597135;
double r597139 = r597129 + r597138;
double r597140 = r597139 / r597128;
double r597141 = r597128 / r597140;
double r597142 = exp(r597141);
double r597143 = r597139 / r597135;
double r597144 = r597137 / r597143;
double r597145 = exp(r597144);
double r597146 = r597142 / r597145;
double r597147 = log(r597146);
double r597148 = 2.977178009046746e+272;
bool r597149 = r597129 <= r597148;
double r597150 = 1.0;
double r597151 = r597149 ? r597132 : r597150;
double r597152 = r597134 ? r597147 : r597151;
double r597153 = r597131 ? r597132 : r597152;
return r597153;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.3 |
|---|---|
| Target | 31.0 |
| Herbie | 12.6 |
if (* x x) < 1.0466238436121007e-202 or 1.3005275433696336e+250 < (* x x) < 2.977178009046746e+272Initial program 25.6
Taylor expanded around 0 12.7
if 1.0466238436121007e-202 < (* x x) < 1.3005275433696336e+250Initial program 15.7
rmApplied add-sqr-sqrt15.7
rmApplied add-log-exp15.7
Simplified15.2
if 2.977178009046746e+272 < (* x x) Initial program 59.2
Taylor expanded around inf 8.9
Final simplification12.6
herbie shell --seed 2020064
(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))))