Average Error: 31.8 → 0
Time: 7.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 r93081 = x;
        double r93082 = r93081 / r93081;
        double r93083 = 1.0;
        double r93084 = r93083 / r93081;
        double r93085 = r93081 * r93081;
        double r93086 = sqrt(r93085);
        double r93087 = r93084 * r93086;
        double r93088 = r93082 - r93087;
        return r93088;
}

double f(double x) {
        double r93089 = 1.0;
        double r93090 = 1.0;
        double r93091 = x;
        double r93092 = fabs(r93091);
        double r93093 = r93092 / r93091;
        double r93094 = r93090 * r93093;
        double r93095 = r93089 - r93094;
        double r93096 = 3.0;
        double r93097 = pow(r93095, r93096);
        double r93098 = cbrt(r93097);
        return r93098;
}

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)))))