Average Error: 19.7 → 0.0
Time: 19.8s
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]{\frac{\left(x - y\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)} \cdot \left(\frac{\left(x - y\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{\left(x - y\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)}\right)}\]
\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\sqrt[3]{\frac{\left(x - y\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)} \cdot \left(\frac{\left(x - y\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{\left(x - y\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)}\right)}
double f(double x, double y) {
        double r3059944 = x;
        double r3059945 = y;
        double r3059946 = r3059944 - r3059945;
        double r3059947 = r3059944 + r3059945;
        double r3059948 = r3059946 * r3059947;
        double r3059949 = r3059944 * r3059944;
        double r3059950 = r3059945 * r3059945;
        double r3059951 = r3059949 + r3059950;
        double r3059952 = r3059948 / r3059951;
        return r3059952;
}

double f(double x, double y) {
        double r3059953 = x;
        double r3059954 = y;
        double r3059955 = r3059953 - r3059954;
        double r3059956 = r3059954 + r3059953;
        double r3059957 = hypot(r3059953, r3059954);
        double r3059958 = r3059956 / r3059957;
        double r3059959 = r3059955 * r3059958;
        double r3059960 = r3059959 / r3059957;
        double r3059961 = r3059960 * r3059960;
        double r3059962 = r3059960 * r3059961;
        double r3059963 = cbrt(r3059962);
        return r3059963;
}

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.7
Target0.0
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.7

    \[\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt19.7

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

    \[\leadsto \color{blue}{\frac{x - y}{\sqrt{x \cdot x + y \cdot y}} \cdot \frac{x + y}{\sqrt{x \cdot x + y \cdot y}}}\]
  5. Using strategy rm
  6. Applied add-cbrt-cube31.7

    \[\leadsto \frac{x - y}{\sqrt{x \cdot x + y \cdot y}} \cdot \frac{x + y}{\color{blue}{\sqrt[3]{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}}\]
  7. Applied add-cbrt-cube31.6

    \[\leadsto \frac{x - y}{\sqrt{x \cdot x + y \cdot y}} \cdot \frac{\color{blue}{\sqrt[3]{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}}}{\sqrt[3]{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}\]
  8. Applied cbrt-undiv31.6

    \[\leadsto \frac{x - y}{\sqrt{x \cdot x + y \cdot y}} \cdot \color{blue}{\sqrt[3]{\frac{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}}\]
  9. Applied add-cbrt-cube32.2

    \[\leadsto \frac{x - y}{\color{blue}{\sqrt[3]{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}} \cdot \sqrt[3]{\frac{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}\]
  10. Applied add-cbrt-cube31.6

    \[\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(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}} \cdot \sqrt[3]{\frac{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}\]
  11. Applied cbrt-undiv31.6

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x - y\right) \cdot \left(x - y\right)\right) \cdot \left(x - y\right)}{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}} \cdot \sqrt[3]{\frac{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)}{\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}\right) \cdot \sqrt{x \cdot x + y \cdot y}}}\]
  12. Applied cbrt-unprod31.6

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

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

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

Reproduce

herbie shell --seed 2019163 +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))))