Average Error: 19.5 → 0.0
Time: 36.2s
Precision: 64
\[0 \lt x \lt 1 \land y \lt 1\]
\[\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\]
\[\sqrt[3]{\left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right) \cdot \left(\left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right) \cdot \left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)\right)}\]
\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\sqrt[3]{\left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right) \cdot \left(\left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right) \cdot \left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)\right)}
double f(double x, double y) {
        double r2764405 = x;
        double r2764406 = y;
        double r2764407 = r2764405 - r2764406;
        double r2764408 = r2764405 + r2764406;
        double r2764409 = r2764407 * r2764408;
        double r2764410 = r2764405 * r2764405;
        double r2764411 = r2764406 * r2764406;
        double r2764412 = r2764410 + r2764411;
        double r2764413 = r2764409 / r2764412;
        return r2764413;
}

double f(double x, double y) {
        double r2764414 = x;
        double r2764415 = y;
        double r2764416 = r2764414 + r2764415;
        double r2764417 = hypot(r2764415, r2764414);
        double r2764418 = r2764416 / r2764417;
        double r2764419 = r2764418 / r2764417;
        double r2764420 = r2764414 - r2764415;
        double r2764421 = r2764419 * r2764420;
        double r2764422 = r2764421 * r2764421;
        double r2764423 = r2764421 * r2764422;
        double r2764424 = cbrt(r2764423);
        return r2764424;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.5
Target0.1
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;0.5 \lt \left|\frac{x}{y}\right| \lt 2:\\ \;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{2}{1 + \frac{x}{y} \cdot \frac{x}{y}}\\ \end{array}\]

Derivation

  1. Initial program 19.5

    \[\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\]
  2. Simplified19.5

    \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot \left(x - y\right)}{\mathsf{fma}\left(y, y, x \cdot x\right)}}\]
  3. Using strategy rm
  4. Applied clear-num19.5

    \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(y, y, x \cdot x\right)}{\left(x + y\right) \cdot \left(x - y\right)}}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt19.5

    \[\leadsto \frac{1}{\frac{\color{blue}{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)} \cdot \sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}}{\left(x + y\right) \cdot \left(x - y\right)}}\]
  7. Applied times-frac19.6

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}{x + y} \cdot \frac{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}{x - y}}}\]
  8. Applied add-cube-cbrt19.6

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}{x + y} \cdot \frac{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}{x - y}}\]
  9. Applied times-frac19.6

    \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}{x + y}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}{x - y}}}\]
  10. Simplified19.5

    \[\leadsto \color{blue}{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(y, y, x \cdot x\right)}}{x - y}}\]
  11. Simplified0.0

    \[\leadsto \frac{x + y}{\mathsf{hypot}\left(y, x\right)} \cdot \color{blue}{\frac{x - y}{\mathsf{hypot}\left(y, x\right)}}\]
  12. Using strategy rm
  13. Applied add-cbrt-cube0.1

    \[\leadsto \frac{x + y}{\mathsf{hypot}\left(y, x\right)} \cdot \color{blue}{\sqrt[3]{\left(\frac{x - y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}\right) \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}}}\]
  14. Applied add-cbrt-cube31.2

    \[\leadsto \frac{x + y}{\color{blue}{\sqrt[3]{\left(\mathsf{hypot}\left(y, x\right) \cdot \mathsf{hypot}\left(y, x\right)\right) \cdot \mathsf{hypot}\left(y, x\right)}}} \cdot \sqrt[3]{\left(\frac{x - y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}\right) \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}}\]
  15. Applied add-cbrt-cube31.2

    \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}}}{\sqrt[3]{\left(\mathsf{hypot}\left(y, x\right) \cdot \mathsf{hypot}\left(y, x\right)\right) \cdot \mathsf{hypot}\left(y, x\right)}} \cdot \sqrt[3]{\left(\frac{x - y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}\right) \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}}\]
  16. Applied cbrt-undiv31.1

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}{\left(\mathsf{hypot}\left(y, x\right) \cdot \mathsf{hypot}\left(y, x\right)\right) \cdot \mathsf{hypot}\left(y, x\right)}}} \cdot \sqrt[3]{\left(\frac{x - y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}\right) \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}}\]
  17. Applied cbrt-unprod31.1

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}{\left(\mathsf{hypot}\left(y, x\right) \cdot \mathsf{hypot}\left(y, x\right)\right) \cdot \mathsf{hypot}\left(y, x\right)} \cdot \left(\left(\frac{x - y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}\right) \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}\right)}}\]
  18. Simplified0.0

    \[\leadsto \sqrt[3]{\color{blue}{\left(\left(\frac{\frac{y + x}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right) \cdot \left(\frac{\frac{y + x}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)\right) \cdot \left(\frac{\frac{y + x}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)}}\]
  19. Final simplification0.0

    \[\leadsto \sqrt[3]{\left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right) \cdot \left(\left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right) \cdot \left(\frac{\frac{x + y}{\mathsf{hypot}\left(y, x\right)}}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)\right)}\]

Reproduce

herbie shell --seed 2019143 +o rules:numerics
(FPCore (x y)
  :name "Kahan p9 Example"
  :pre (and (< 0 x 1) (< y 1))

  :herbie-target
  (if (< 0.5 (fabs (/ x y)) 2) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1 (/ 2 (+ 1 (* (/ x y) (/ x y))))))

  (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))