Average Error: 31.9 → 0
Time: 5.1s
Precision: 64
\[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
\[\sqrt[3]{{\left(1 - 1 \cdot \frac{\left|x\right|}{x}\right)}^{3}}\]
\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}
\sqrt[3]{{\left(1 - 1 \cdot \frac{\left|x\right|}{x}\right)}^{3}}
double f(double x) {
        double r10731 = x;
        double r10732 = r10731 / r10731;
        double r10733 = 1.0;
        double r10734 = r10733 / r10731;
        double r10735 = r10731 * r10731;
        double r10736 = sqrt(r10735);
        double r10737 = r10734 * r10736;
        double r10738 = r10732 - r10737;
        return r10738;
}

double f(double x) {
        double r10739 = 1.0;
        double r10740 = 1.0;
        double r10741 = x;
        double r10742 = fabs(r10741);
        double r10743 = r10742 / r10741;
        double r10744 = r10740 * r10743;
        double r10745 = r10739 - r10744;
        double r10746 = 3.0;
        double r10747 = pow(r10745, r10746);
        double r10748 = cbrt(r10747);
        return r10748;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original31.9
Target0
Herbie0
\[\begin{array}{l} \mathbf{if}\;x \lt 0.0:\\ \;\;\;\;2\\ \mathbf{else}:\\ \;\;\;\;0.0\\ \end{array}\]

Derivation

  1. Initial program 31.9

    \[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
  2. Simplified4.7

    \[\leadsto \color{blue}{1 - \frac{1}{x} \cdot \left|x\right|}\]
  3. Using strategy rm
  4. Applied add-cbrt-cube4.7

    \[\leadsto \color{blue}{\sqrt[3]{\left(\left(1 - \frac{1}{x} \cdot \left|x\right|\right) \cdot \left(1 - \frac{1}{x} \cdot \left|x\right|\right)\right) \cdot \left(1 - \frac{1}{x} \cdot \left|x\right|\right)}}\]
  5. Simplified0

    \[\leadsto \sqrt[3]{\color{blue}{{\left(1 - 1 \cdot \frac{\left|x\right|}{x}\right)}^{3}}}\]
  6. Final simplification0

    \[\leadsto \sqrt[3]{{\left(1 - 1 \cdot \frac{\left|x\right|}{x}\right)}^{3}}\]

Reproduce

herbie shell --seed 2019310 
(FPCore (x)
  :name "sqrt sqr"
  :precision binary64

  :herbie-target
  (if (< x 0.0) 2 0.0)

  (- (/ x x) (* (/ 1 x) (sqrt (* x x)))))