Average Error: 31.8 → 0
Time: 6.5s
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 r67961 = x;
        double r67962 = r67961 / r67961;
        double r67963 = 1.0;
        double r67964 = r67963 / r67961;
        double r67965 = r67961 * r67961;
        double r67966 = sqrt(r67965);
        double r67967 = r67964 * r67966;
        double r67968 = r67962 - r67967;
        return r67968;
}

double f(double x) {
        double r67969 = 1.0;
        double r67970 = 1.0;
        double r67971 = x;
        double r67972 = fabs(r67971);
        double r67973 = r67972 / r67971;
        double r67974 = r67970 * r67973;
        double r67975 = r67969 - r67974;
        double r67976 = 3.0;
        double r67977 = pow(r67975, r67976);
        double r67978 = cbrt(r67977);
        return r67978;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 31.8

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

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

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

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

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