Average Error: 32.1 → 0
Time: 1.4s
Precision: 64
\[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
\[\frac{x}{x} - \sqrt[3]{{\left(\frac{\left|x\right| \cdot 1}{x}\right)}^{3}}\]
\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}
\frac{x}{x} - \sqrt[3]{{\left(\frac{\left|x\right| \cdot 1}{x}\right)}^{3}}
double f(double x) {
        double r142798 = x;
        double r142799 = r142798 / r142798;
        double r142800 = 1.0;
        double r142801 = r142800 / r142798;
        double r142802 = r142798 * r142798;
        double r142803 = sqrt(r142802);
        double r142804 = r142801 * r142803;
        double r142805 = r142799 - r142804;
        return r142805;
}

double f(double x) {
        double r142806 = x;
        double r142807 = r142806 / r142806;
        double r142808 = fabs(r142806);
        double r142809 = 1.0;
        double r142810 = r142808 * r142809;
        double r142811 = r142810 / r142806;
        double r142812 = 3.0;
        double r142813 = pow(r142811, r142812);
        double r142814 = cbrt(r142813);
        double r142815 = r142807 - r142814;
        return r142815;
}

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. Using strategy rm
  3. Applied add-cbrt-cube45.7

    \[\leadsto \frac{x}{x} - \frac{1}{x} \cdot \color{blue}{\sqrt[3]{\left(\sqrt{x \cdot x} \cdot \sqrt{x \cdot x}\right) \cdot \sqrt{x \cdot x}}}\]
  4. Applied add-cbrt-cube43.9

    \[\leadsto \frac{x}{x} - \frac{1}{\color{blue}{\sqrt[3]{\left(x \cdot x\right) \cdot x}}} \cdot \sqrt[3]{\left(\sqrt{x \cdot x} \cdot \sqrt{x \cdot x}\right) \cdot \sqrt{x \cdot x}}\]
  5. Applied add-cbrt-cube43.9

    \[\leadsto \frac{x}{x} - \frac{\color{blue}{\sqrt[3]{\left(1 \cdot 1\right) \cdot 1}}}{\sqrt[3]{\left(x \cdot x\right) \cdot x}} \cdot \sqrt[3]{\left(\sqrt{x \cdot x} \cdot \sqrt{x \cdot x}\right) \cdot \sqrt{x \cdot x}}\]
  6. Applied cbrt-undiv49.5

    \[\leadsto \frac{x}{x} - \color{blue}{\sqrt[3]{\frac{\left(1 \cdot 1\right) \cdot 1}{\left(x \cdot x\right) \cdot x}}} \cdot \sqrt[3]{\left(\sqrt{x \cdot x} \cdot \sqrt{x \cdot x}\right) \cdot \sqrt{x \cdot x}}\]
  7. Applied cbrt-unprod42.7

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

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

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

Reproduce

herbie shell --seed 2019352 +o rules:numerics
(FPCore (x)
  :name "sqrt sqr"
  :precision binary64

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

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