Average Error: 32.1 → 0
Time: 3.0s
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 r132918 = x;
        double r132919 = r132918 / r132918;
        double r132920 = 1.0;
        double r132921 = r132920 / r132918;
        double r132922 = r132918 * r132918;
        double r132923 = sqrt(r132922);
        double r132924 = r132921 * r132923;
        double r132925 = r132919 - r132924;
        return r132925;
}

double f(double x) {
        double r132926 = 1.0;
        double r132927 = 1.0;
        double r132928 = x;
        double r132929 = fabs(r132928);
        double r132930 = r132929 / r132928;
        double r132931 = r132927 * r132930;
        double r132932 = r132926 - r132931;
        double r132933 = 3.0;
        double r132934 = pow(r132932, r132933);
        double r132935 = cbrt(r132934);
        return r132935;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 32.1

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

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

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

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

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