Average Error: 32.4 → 0
Time: 6.8s
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 r94522 = x;
        double r94523 = r94522 / r94522;
        double r94524 = 1.0;
        double r94525 = r94524 / r94522;
        double r94526 = r94522 * r94522;
        double r94527 = sqrt(r94526);
        double r94528 = r94525 * r94527;
        double r94529 = r94523 - r94528;
        return r94529;
}

double f(double x) {
        double r94530 = 1.0;
        double r94531 = 1.0;
        double r94532 = x;
        double r94533 = fabs(r94532);
        double r94534 = r94533 / r94532;
        double r94535 = r94531 * r94534;
        double r94536 = r94530 - r94535;
        double r94537 = 3.0;
        double r94538 = pow(r94536, r94537);
        double r94539 = cbrt(r94538);
        return r94539;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 32.4

    \[\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 2019323 
(FPCore (x)
  :name "sqrt sqr"
  :precision binary64

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

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