\frac{x0}{1 - x1} - x0\begin{array}{l}
\mathbf{if}\;x0 \le 1.87492187499999985:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt{x0}}{\sqrt{1} + \sqrt{x1}}, \frac{\sqrt{x0}}{\sqrt{1} - \sqrt{x1}}, -x0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)}^{3} + {\left(\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)\right)}^{3}}{\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1} \cdot {x0}^{\frac{2}{3}}\right) + \log \left(\sqrt{e^{x0}}\right) \cdot \log \left(\sqrt{e^{x0}}\right)}\\
\end{array}double f(double x0, double x1) {
double r182276 = x0;
double r182277 = 1.0;
double r182278 = x1;
double r182279 = r182277 - r182278;
double r182280 = r182276 / r182279;
double r182281 = r182280 - r182276;
return r182281;
}
double f(double x0, double x1) {
double r182282 = x0;
double r182283 = 1.8749218749999998;
bool r182284 = r182282 <= r182283;
double r182285 = sqrt(r182282);
double r182286 = 1.0;
double r182287 = sqrt(r182286);
double r182288 = x1;
double r182289 = sqrt(r182288);
double r182290 = r182287 + r182289;
double r182291 = r182285 / r182290;
double r182292 = r182287 - r182289;
double r182293 = r182285 / r182292;
double r182294 = -r182282;
double r182295 = fma(r182291, r182293, r182294);
double r182296 = 1.0;
double r182297 = exp(r182282);
double r182298 = sqrt(r182297);
double r182299 = r182296 / r182298;
double r182300 = log(r182299);
double r182301 = 3.0;
double r182302 = pow(r182300, r182301);
double r182303 = cbrt(r182282);
double r182304 = r182286 - r182288;
double r182305 = r182303 / r182304;
double r182306 = 0.6666666666666666;
double r182307 = pow(r182282, r182306);
double r182308 = fma(r182305, r182307, r182300);
double r182309 = pow(r182308, r182301);
double r182310 = r182302 + r182309;
double r182311 = r182305 * r182307;
double r182312 = r182308 * r182311;
double r182313 = log(r182298);
double r182314 = r182313 * r182313;
double r182315 = r182312 + r182314;
double r182316 = r182310 / r182315;
double r182317 = r182284 ? r182295 : r182316;
return r182317;
}




Bits error versus x0




Bits error versus x1
| Original | 7.9 |
|---|---|
| Target | 0.3 |
| Herbie | 4.4 |
if x0 < 1.8749218749999998Initial program 7.5
rmApplied add-sqr-sqrt7.5
Applied add-sqr-sqrt7.5
Applied difference-of-squares7.5
Applied add-sqr-sqrt7.5
Applied times-frac7.5
Applied fma-neg5.4
if 1.8749218749999998 < x0 Initial program 8.2
rmApplied *-un-lft-identity8.2
Applied add-cube-cbrt8.2
Applied times-frac8.2
Applied fma-neg7.0
rmApplied add-log-exp7.5
Simplified5.7
rmApplied add-sqr-sqrt6.5
Applied *-un-lft-identity6.5
Applied unpow-prod-down6.5
Applied times-frac5.7
Applied log-prod5.7
Simplified5.7
Simplified5.7
rmApplied flip3-+3.5
Simplified3.5
Final simplification4.4
herbie shell --seed 2020046 +o rules:numerics
(FPCore (x0 x1)
:name "(- (/ x0 (- 1 x1)) x0)"
:precision binary64
:pre (or (and (== x0 1.855) (== x1 0.000209)) (and (== x0 2.985) (== x1 0.0186)))
:herbie-target
(/ (* x0 x1) (- 1 x1))
(- (/ x0 (- 1 x1)) x0))