1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\begin{array}{l}
\mathbf{if}\;x \le -0.002150518847943041871040303902873347396962:\\
\;\;\;\;\frac{1 \cdot 1 - \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5}{1 + \sqrt{0.5 \cdot \left(1 + \log \left(e^{\frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)\right)}}\\
\mathbf{elif}\;x \le 0.001774327303338343181371428158854541834444:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.25, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}}, 0.5 - \mathsf{fma}\left(\frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}}, 0.1875, \frac{0.5}{\sqrt{1}}\right)\right)}{1 + \sqrt{0.5 \cdot \left(1 + \log \left(e^{\frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{1}^{6} - \mathsf{expm1}\left(\mathsf{log1p}\left({\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}\right)\right)}{\mathsf{fma}\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 0.5 \cdot \mathsf{fma}\left(1, 1, \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right), {1}^{4}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \log \left(e^{\frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)\right)}}\\
\end{array}double f(double x) {
double r139358 = 1.0;
double r139359 = 0.5;
double r139360 = x;
double r139361 = hypot(r139358, r139360);
double r139362 = r139358 / r139361;
double r139363 = r139358 + r139362;
double r139364 = r139359 * r139363;
double r139365 = sqrt(r139364);
double r139366 = r139358 - r139365;
return r139366;
}
double f(double x) {
double r139367 = x;
double r139368 = -0.002150518847943042;
bool r139369 = r139367 <= r139368;
double r139370 = 1.0;
double r139371 = r139370 * r139370;
double r139372 = hypot(r139370, r139367);
double r139373 = r139370 / r139372;
double r139374 = r139370 + r139373;
double r139375 = 0.5;
double r139376 = r139374 * r139375;
double r139377 = r139371 - r139376;
double r139378 = exp(r139373);
double r139379 = log(r139378);
double r139380 = r139370 + r139379;
double r139381 = r139375 * r139380;
double r139382 = sqrt(r139381);
double r139383 = r139370 + r139382;
double r139384 = r139377 / r139383;
double r139385 = 0.0017743273033383432;
bool r139386 = r139367 <= r139385;
double r139387 = 0.25;
double r139388 = 2.0;
double r139389 = pow(r139367, r139388);
double r139390 = sqrt(r139370);
double r139391 = 3.0;
double r139392 = pow(r139390, r139391);
double r139393 = r139389 / r139392;
double r139394 = 4.0;
double r139395 = pow(r139367, r139394);
double r139396 = 5.0;
double r139397 = pow(r139390, r139396);
double r139398 = r139395 / r139397;
double r139399 = 0.1875;
double r139400 = r139375 / r139390;
double r139401 = fma(r139398, r139399, r139400);
double r139402 = r139375 - r139401;
double r139403 = fma(r139387, r139393, r139402);
double r139404 = r139403 / r139383;
double r139405 = 6.0;
double r139406 = pow(r139370, r139405);
double r139407 = pow(r139376, r139391);
double r139408 = log1p(r139407);
double r139409 = expm1(r139408);
double r139410 = r139406 - r139409;
double r139411 = fma(r139370, r139370, r139376);
double r139412 = r139375 * r139411;
double r139413 = pow(r139370, r139394);
double r139414 = fma(r139374, r139412, r139413);
double r139415 = r139410 / r139414;
double r139416 = r139415 / r139383;
double r139417 = r139386 ? r139404 : r139416;
double r139418 = r139369 ? r139384 : r139417;
return r139418;
}



Bits error versus x
if x < -0.002150518847943042Initial program 1.0
rmApplied flip--1.0
Simplified0.1
rmApplied add-log-exp0.1
if -0.002150518847943042 < x < 0.0017743273033383432Initial program 29.9
rmApplied flip--29.9
Simplified29.9
rmApplied add-log-exp29.9
Taylor expanded around 0 29.9
Simplified0.2
if 0.0017743273033383432 < x Initial program 1.0
rmApplied flip--1.0
Simplified0.1
rmApplied add-log-exp0.1
rmApplied flip3--0.1
Simplified0.1
Simplified0.1
rmApplied expm1-log1p-u0.1
Final simplification0.2
herbie shell --seed 2019325 +o rules:numerics
(FPCore (x)
:name "Given's Rotation SVD example, simplified"
:precision binary64
(- 1 (sqrt (* 0.5 (+ 1 (/ 1 (hypot 1 x)))))))