Average Error: 32.1 → 0
Time: 2.2s
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 r106764 = x;
        double r106765 = r106764 / r106764;
        double r106766 = 1.0;
        double r106767 = r106766 / r106764;
        double r106768 = r106764 * r106764;
        double r106769 = sqrt(r106768);
        double r106770 = r106767 * r106769;
        double r106771 = r106765 - r106770;
        return r106771;
}

double f(double x) {
        double r106772 = x;
        double r106773 = r106772 / r106772;
        double r106774 = fabs(r106772);
        double r106775 = 1.0;
        double r106776 = r106774 * r106775;
        double r106777 = r106776 / r106772;
        double r106778 = 3.0;
        double r106779 = pow(r106777, r106778);
        double r106780 = cbrt(r106779);
        double r106781 = r106773 - r106780;
        return r106781;
}

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.3

    \[\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.6

    \[\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.6

    \[\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.1

    \[\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.3

    \[\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 2020035 +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)))))