Average Error: 20.5 → 0.0
Time: 23.6s
Precision: 64
\[0.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{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \left(\left(\frac{y + x}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}\right)\right) \cdot \sqrt[3]{\left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right) \cdot \left(\left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right) \cdot \left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\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{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \left(\left(\frac{y + x}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}\right)\right) \cdot \sqrt[3]{\left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right) \cdot \left(\left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right) \cdot \left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right)\right)}}
double f(double x, double y) {
        double r3818816 = x;
        double r3818817 = y;
        double r3818818 = r3818816 - r3818817;
        double r3818819 = r3818816 + r3818817;
        double r3818820 = r3818818 * r3818819;
        double r3818821 = r3818816 * r3818816;
        double r3818822 = r3818817 * r3818817;
        double r3818823 = r3818821 + r3818822;
        double r3818824 = r3818820 / r3818823;
        return r3818824;
}

double f(double x, double y) {
        double r3818825 = x;
        double r3818826 = y;
        double r3818827 = r3818825 - r3818826;
        double r3818828 = hypot(r3818825, r3818826);
        double r3818829 = r3818827 / r3818828;
        double r3818830 = r3818826 + r3818825;
        double r3818831 = r3818830 / r3818828;
        double r3818832 = r3818831 * r3818831;
        double r3818833 = r3818832 * r3818831;
        double r3818834 = r3818829 * r3818833;
        double r3818835 = r3818829 * r3818829;
        double r3818836 = r3818835 * r3818835;
        double r3818837 = r3818835 * r3818836;
        double r3818838 = cbrt(r3818837);
        double r3818839 = r3818834 * r3818838;
        double r3818840 = cbrt(r3818839);
        return r3818840;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.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 20.5

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

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

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

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

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

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

    \[\leadsto \frac{x - y}{\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}} \cdot \color{blue}{\sqrt[3]{\frac{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(y + x\right)}{\left(\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}\right) \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}}}\]
  10. Applied add-cbrt-cube33.0

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

    \[\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{\mathsf{fma}\left(x, x, y \cdot y\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}\right) \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}} \cdot \sqrt[3]{\frac{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(y + x\right)}{\left(\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}\right) \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}}\]
  12. Applied cbrt-undiv32.3

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x - y\right) \cdot \left(x - y\right)\right) \cdot \left(x - y\right)}{\left(\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}\right) \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}}} \cdot \sqrt[3]{\frac{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(y + x\right)}{\left(\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}\right) \cdot \sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}}\]
  13. Applied cbrt-unprod32.3

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

    \[\leadsto \sqrt[3]{\color{blue}{\left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \left(\frac{y + x}{\mathsf{hypot}\left(x, y\right)} \cdot \left(\frac{y + x}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}\right)\right)\right) \cdot \left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right)}}\]
  15. Using strategy rm
  16. Applied add-cbrt-cube0.0

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

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

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(FPCore (x y)
  :name "Kahan p9 Example"
  :pre (and (< 0.0 x 1.0) (< y 1.0))

  :herbie-target
  (if (< 0.5 (fabs (/ x y)) 2.0) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))

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