Average Error: 7.9 → 6.9
Time: 6.9s
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 r2925018 = x0;
        double r2925019 = 1.0;
        double r2925020 = x1;
        double r2925021 = r2925019 - r2925020;
        double r2925022 = r2925018 / r2925021;
        double r2925023 = r2925022 - r2925018;
        return r2925023;
}

double f(double x0, double x1) {
        double r2925024 = x0;
        double r2925025 = cbrt(r2925024);
        double r2925026 = r2925025 * r2925025;
        double r2925027 = 1.0;
        double r2925028 = x1;
        double r2925029 = r2925027 - r2925028;
        double r2925030 = r2925025 / r2925029;
        double r2925031 = -r2925024;
        double r2925032 = fma(r2925026, r2925030, r2925031);
        return r2925032;
}

Error

Bits error versus x0

Bits error versus x1

Target

Original7.9
Target0.3
Herbie6.9
\[\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.2

    \[\leadsto \color{blue}{\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1} \cdot \frac{\sqrt[3]{x0}}{1 - x1}} - x0\]
  6. 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)}\]
  7. 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 2019156 +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))