Average Error: 7.9 → 7.0
Time: 24.4s
Precision: 64
\[x0 = 1.854999999999999982236431605997495353222 \land x1 = 2.090000000000000115064208161541614572343 \cdot 10^{-4} \lor x0 = 2.984999999999999875655021241982467472553 \land x1 = 0.01859999999999999847899445626353553961962\]
\[\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 r5820031 = x0;
        double r5820032 = 1.0;
        double r5820033 = x1;
        double r5820034 = r5820032 - r5820033;
        double r5820035 = r5820031 / r5820034;
        double r5820036 = r5820035 - r5820031;
        return r5820036;
}

double f(double x0, double x1) {
        double r5820037 = x0;
        double r5820038 = cbrt(r5820037);
        double r5820039 = r5820038 * r5820038;
        double r5820040 = 1.0;
        double r5820041 = x1;
        double r5820042 = r5820040 - r5820041;
        double r5820043 = r5820038 / r5820042;
        double r5820044 = -r5820037;
        double r5820045 = fma(r5820039, r5820043, r5820044);
        return r5820045;
}

Error

Bits error versus x0

Bits error versus x1

Target

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

    \[\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 2019200 +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.0 x1))

  (- (/ x0 (- 1.0 x1)) x0))