Average Error: 7.8 → 6.9
Time: 10.6s
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 r4902041 = x0;
        double r4902042 = 1.0;
        double r4902043 = x1;
        double r4902044 = r4902042 - r4902043;
        double r4902045 = r4902041 / r4902044;
        double r4902046 = r4902045 - r4902041;
        return r4902046;
}

double f(double x0, double x1) {
        double r4902047 = x0;
        double r4902048 = cbrt(r4902047);
        double r4902049 = r4902048 * r4902048;
        double r4902050 = 1.0;
        double r4902051 = x1;
        double r4902052 = r4902050 - r4902051;
        double r4902053 = r4902048 / r4902052;
        double r4902054 = -r4902047;
        double r4902055 = fma(r4902049, r4902053, r4902054);
        return r4902055;
}

Error

Bits error versus x0

Bits error versus x1

Target

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

Derivation

  1. Initial program 7.8

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

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

    \[\leadsto \frac{x0}{\color{blue}{1 \cdot 1} - 1 \cdot x1} - x0\]
  5. Applied distribute-lft-out--7.8

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

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

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

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

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

Reproduce

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