Average Error: 31.6 → 0.0
Time: 11.6s
Precision: 64
\[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
\[e^{\mathsf{log1p}\left(\left(\sqrt[3]{\left|x\right| \cdot \frac{-1}{x}} \cdot \sqrt[3]{\left|x\right| \cdot \frac{-1}{x}}\right) \cdot \sqrt[3]{\left|x\right| \cdot \frac{-1}{x}}\right)}\]
\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}
e^{\mathsf{log1p}\left(\left(\sqrt[3]{\left|x\right| \cdot \frac{-1}{x}} \cdot \sqrt[3]{\left|x\right| \cdot \frac{-1}{x}}\right) \cdot \sqrt[3]{\left|x\right| \cdot \frac{-1}{x}}\right)}
double f(double x) {
        double r82316 = x;
        double r82317 = r82316 / r82316;
        double r82318 = 1.0;
        double r82319 = r82318 / r82316;
        double r82320 = r82316 * r82316;
        double r82321 = sqrt(r82320);
        double r82322 = r82319 * r82321;
        double r82323 = r82317 - r82322;
        return r82323;
}

double f(double x) {
        double r82324 = x;
        double r82325 = fabs(r82324);
        double r82326 = 1.0;
        double r82327 = -r82326;
        double r82328 = r82327 / r82324;
        double r82329 = r82325 * r82328;
        double r82330 = cbrt(r82329);
        double r82331 = r82330 * r82330;
        double r82332 = r82331 * r82330;
        double r82333 = log1p(r82332);
        double r82334 = exp(r82333);
        return r82334;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 31.6

    \[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
  2. Simplified31.3

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left|x\right|, \frac{-1}{x}, 1\right)}\]
  3. Using strategy rm
  4. Applied add-exp-log31.8

    \[\leadsto \color{blue}{e^{\log \left(\mathsf{fma}\left(\left|x\right|, \frac{-1}{x}, 1\right)\right)}}\]
  5. Simplified5.0

    \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(\left|x\right| \cdot \frac{-1}{x}\right)}}\]
  6. Using strategy rm
  7. Applied add-cube-cbrt0.0

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

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

Reproduce

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

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

  (- (/ x x) (* (/ 1.0 x) (sqrt (* x x)))))