\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 \le -4.452213238363225603526830662891862420183 \cdot 10^{134}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(1\right)\right)\\
\mathbf{elif}\;x \le -1.751961519124681504554348985455740434235 \cdot 10^{-113}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{x}^{2}}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{4 \cdot {y}^{2}}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\right)\right)\\
\mathbf{elif}\;x \le 1.524472339546404145946734820851418870368 \cdot 10^{-122}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(-1\right)\right)\\
\mathbf{elif}\;x \le 7.812277400687207974693837013539398746936 \cdot 10^{107}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{x}^{2}}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{4 \cdot {y}^{2}}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(1\right)\right)\\
\end{array}double f(double x, double y) {
double r423147 = x;
double r423148 = r423147 * r423147;
double r423149 = y;
double r423150 = 4.0;
double r423151 = r423149 * r423150;
double r423152 = r423151 * r423149;
double r423153 = r423148 - r423152;
double r423154 = r423148 + r423152;
double r423155 = r423153 / r423154;
return r423155;
}
double f(double x, double y) {
double r423156 = x;
double r423157 = -4.452213238363226e+134;
bool r423158 = r423156 <= r423157;
double r423159 = 1.0;
double r423160 = log1p(r423159);
double r423161 = expm1(r423160);
double r423162 = -1.7519615191246815e-113;
bool r423163 = r423156 <= r423162;
double r423164 = 2.0;
double r423165 = pow(r423156, r423164);
double r423166 = y;
double r423167 = 4.0;
double r423168 = r423166 * r423167;
double r423169 = r423168 * r423166;
double r423170 = fma(r423156, r423156, r423169);
double r423171 = r423165 / r423170;
double r423172 = pow(r423166, r423164);
double r423173 = r423167 * r423172;
double r423174 = r423173 / r423170;
double r423175 = r423171 - r423174;
double r423176 = log1p(r423175);
double r423177 = expm1(r423176);
double r423178 = 1.5244723395464041e-122;
bool r423179 = r423156 <= r423178;
double r423180 = 1.0;
double r423181 = -r423180;
double r423182 = log1p(r423181);
double r423183 = expm1(r423182);
double r423184 = 7.812277400687208e+107;
bool r423185 = r423156 <= r423184;
double r423186 = r423185 ? r423177 : r423161;
double r423187 = r423179 ? r423183 : r423186;
double r423188 = r423163 ? r423177 : r423187;
double r423189 = r423158 ? r423161 : r423188;
return r423189;
}




Bits error versus x




Bits error versus y
| Original | 31.6 |
|---|---|
| Target | 31.3 |
| Herbie | 11.8 |
if x < -4.452213238363226e+134 or 7.812277400687208e+107 < x Initial program 54.9
rmApplied expm1-log1p-u54.9
Simplified54.9
rmApplied div-sub54.9
Taylor expanded around inf 9.7
if -4.452213238363226e+134 < x < -1.7519615191246815e-113 or 1.5244723395464041e-122 < x < 7.812277400687208e+107Initial program 15.5
rmApplied expm1-log1p-u15.5
Simplified15.5
rmApplied div-sub15.5
if -1.7519615191246815e-113 < x < 1.5244723395464041e-122Initial program 28.2
rmApplied expm1-log1p-u28.2
Simplified28.5
rmApplied div-sub28.5
Taylor expanded around 0 9.6
Final simplification11.8
herbie shell --seed 2019208 +o rules:numerics
(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.974323384962678118) (- (/ (* 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))))