Average Error: 7.9 → 7.0
Time: 7.7s
Precision: 64
\[x0 = 1.855 \land x1 = 0.000209 \lor x0 = 2.985 \land x1 = 0.0186\]
\[\frac{x0}{1 - x1} - x0\]
\[\mathsf{fma}\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)\]
\frac{x0}{1 - x1} - x0
\mathsf{fma}\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)
double f(double x0, double x1) {
        double r1946516 = x0;
        double r1946517 = 1.0;
        double r1946518 = x1;
        double r1946519 = r1946517 - r1946518;
        double r1946520 = r1946516 / r1946519;
        double r1946521 = r1946520 - r1946516;
        return r1946521;
}

double f(double x0, double x1) {
        double r1946522 = x0;
        double r1946523 = cbrt(r1946522);
        double r1946524 = r1946523 * r1946523;
        double r1946525 = 1.0;
        double r1946526 = x1;
        double r1946527 = r1946525 - r1946526;
        double r1946528 = r1946523 / r1946527;
        double r1946529 = -r1946522;
        double r1946530 = fma(r1946524, r1946528, r1946529);
        return r1946530;
}

Error

Bits error versus x0

Bits error versus x1

Target

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

Derivation

  1. Initial program 7.9

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

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

    \[\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-frac8.3

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)}\]
  7. Final simplification7.0

    \[\leadsto \mathsf{fma}\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)\]

Reproduce

herbie shell --seed 2019153 +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))