Average Error: 7.8 → 6.0
Time: 24.8s
Precision: 64
\[x0 = 1.855 \land x1 = 0.000209 \lor x0 = 2.985 \land x1 = 0.0186\]
\[\frac{x0}{1 - x1} - x0\]
\[\begin{array}{l} \mathbf{if}\;x1 \le 0.00021208908081054686:\\ \;\;\;\;{e}^{\left(\log \left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;(\left(\frac{\sqrt{x0}}{\sqrt{x1} + 1}\right) \cdot \left(\frac{\sqrt{x0}}{1 - \sqrt{x1}}\right) + \left(-x0\right))_*\\ \end{array}\]
\frac{x0}{1 - x1} - x0
\begin{array}{l}
\mathbf{if}\;x1 \le 0.00021208908081054686:\\
\;\;\;\;{e}^{\left(\log \left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;(\left(\frac{\sqrt{x0}}{\sqrt{x1} + 1}\right) \cdot \left(\frac{\sqrt{x0}}{1 - \sqrt{x1}}\right) + \left(-x0\right))_*\\

\end{array}
double f(double x0, double x1) {
        double r19830990 = x0;
        double r19830991 = 1.0;
        double r19830992 = x1;
        double r19830993 = r19830991 - r19830992;
        double r19830994 = r19830990 / r19830993;
        double r19830995 = r19830994 - r19830990;
        return r19830995;
}

double f(double x0, double x1) {
        double r19830996 = x1;
        double r19830997 = 0.00021208908081054686;
        bool r19830998 = r19830996 <= r19830997;
        double r19830999 = exp(1.0);
        double r19831000 = x0;
        double r19831001 = cbrt(r19831000);
        double r19831002 = r19831001 * r19831001;
        double r19831003 = 1.0;
        double r19831004 = r19831003 - r19830996;
        double r19831005 = r19831001 / r19831004;
        double r19831006 = -r19831000;
        double r19831007 = fma(r19831002, r19831005, r19831006);
        double r19831008 = log(r19831007);
        double r19831009 = pow(r19830999, r19831008);
        double r19831010 = sqrt(r19831000);
        double r19831011 = sqrt(r19830996);
        double r19831012 = r19831011 + r19831003;
        double r19831013 = r19831010 / r19831012;
        double r19831014 = r19831003 - r19831011;
        double r19831015 = r19831010 / r19831014;
        double r19831016 = fma(r19831013, r19831015, r19831006);
        double r19831017 = r19830998 ? r19831009 : r19831016;
        return r19831017;
}

Error

Bits error versus x0

Bits error versus x1

Target

Original7.8
Target0.2
Herbie6.0
\[\frac{x0 \cdot x1}{1 - x1}\]

Derivation

  1. Split input into 2 regimes
  2. if x1 < 0.00021208908081054686

    1. Initial program 11.2

      \[\frac{x0}{1 - x1} - x0\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.2

      \[\leadsto \frac{x0}{\color{blue}{1 \cdot \left(1 - x1\right)}} - x0\]
    4. Applied add-cube-cbrt11.2

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \sqrt[3]{x0}}}{1 \cdot \left(1 - x1\right)} - x0\]
    5. Applied times-frac10.9

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1} \cdot \frac{\sqrt[3]{x0}}{1 - x1}} - x0\]
    6. Applied fma-neg8.9

      \[\leadsto \color{blue}{(\left(\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*}\]
    7. Simplified8.9

      \[\leadsto (\color{blue}{\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right)} \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\]
    8. Using strategy rm
    9. Applied add-exp-log8.9

      \[\leadsto \color{blue}{e^{\log \left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)}}\]
    10. Using strategy rm
    11. Applied pow18.9

      \[\leadsto e^{\log \color{blue}{\left({\left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)}^{1}\right)}}\]
    12. Applied log-pow8.9

      \[\leadsto e^{\color{blue}{1 \cdot \log \left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)}}\]
    13. Applied exp-prod8.9

      \[\leadsto \color{blue}{{\left(e^{1}\right)}^{\left(\log \left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)\right)}}\]
    14. Simplified8.9

      \[\leadsto {\color{blue}{e}}^{\left(\log \left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)\right)}\]

    if 0.00021208908081054686 < x1

    1. Initial program 4.5

      \[\frac{x0}{1 - x1} - x0\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt4.5

      \[\leadsto \frac{x0}{1 - \color{blue}{\sqrt{x1} \cdot \sqrt{x1}}} - x0\]
    4. Applied *-un-lft-identity4.5

      \[\leadsto \frac{x0}{\color{blue}{1 \cdot 1} - \sqrt{x1} \cdot \sqrt{x1}} - x0\]
    5. Applied difference-of-squares4.5

      \[\leadsto \frac{x0}{\color{blue}{\left(1 + \sqrt{x1}\right) \cdot \left(1 - \sqrt{x1}\right)}} - x0\]
    6. Applied add-sqr-sqrt4.5

      \[\leadsto \frac{\color{blue}{\sqrt{x0} \cdot \sqrt{x0}}}{\left(1 + \sqrt{x1}\right) \cdot \left(1 - \sqrt{x1}\right)} - x0\]
    7. Applied times-frac5.2

      \[\leadsto \color{blue}{\frac{\sqrt{x0}}{1 + \sqrt{x1}} \cdot \frac{\sqrt{x0}}{1 - \sqrt{x1}}} - x0\]
    8. Applied fma-neg3.2

      \[\leadsto \color{blue}{(\left(\frac{\sqrt{x0}}{1 + \sqrt{x1}}\right) \cdot \left(\frac{\sqrt{x0}}{1 - \sqrt{x1}}\right) + \left(-x0\right))_*}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification6.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \le 0.00021208908081054686:\\ \;\;\;\;{e}^{\left(\log \left((\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1}\right) + \left(-x0\right))_*\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;(\left(\frac{\sqrt{x0}}{\sqrt{x1} + 1}\right) \cdot \left(\frac{\sqrt{x0}}{1 - \sqrt{x1}}\right) + \left(-x0\right))_*\\ \end{array}\]

Reproduce

herbie shell --seed 2019107 +o rules:numerics
(FPCore (x0 x1)
  :name "(- (/ x0 (- 1 x1)) x0)"
  :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))