Average Error: 19.7 → 0.0
Time: 15.9s
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 r1362045 = x;
        double r1362046 = y;
        double r1362047 = r1362045 - r1362046;
        double r1362048 = r1362045 + r1362046;
        double r1362049 = r1362047 * r1362048;
        double r1362050 = r1362045 * r1362045;
        double r1362051 = r1362046 * r1362046;
        double r1362052 = r1362050 + r1362051;
        double r1362053 = r1362049 / r1362052;
        return r1362053;
}

double f(double x, double y) {
        double r1362054 = x;
        double r1362055 = y;
        double r1362056 = r1362054 - r1362055;
        double r1362057 = r1362055 + r1362054;
        double r1362058 = hypot(r1362054, r1362055);
        double r1362059 = r1362057 / r1362058;
        double r1362060 = r1362056 * r1362059;
        double r1362061 = r1362060 / r1362058;
        double r1362062 = r1362061 * r1362061;
        double r1362063 = r1362061 * r1362062;
        double r1362064 = cbrt(r1362063);
        return r1362064;
}

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

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

    \[\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-log-exp19.7

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

    \[\leadsto \log \left(e^{\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)}}}}\right)\]
  7. Applied times-frac19.7

    \[\leadsto \log \left(e^{\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)}}}}\right)\]
  8. Applied exp-prod19.7

    \[\leadsto \log \color{blue}{\left({\left(e^{\frac{x - y}{\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}}\right)}^{\left(\frac{y + x}{\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}\right)}\right)}\]
  9. Applied log-pow19.7

    \[\leadsto \color{blue}{\frac{y + x}{\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}} \cdot \log \left(e^{\frac{x - y}{\sqrt{\mathsf{fma}\left(x, x, y \cdot y\right)}}}\right)}\]
  10. Simplified19.7

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

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

    \[\leadsto \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)}}}} \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 \frac{x - y}{\mathsf{hypot}\left(x, y\right)}}\]
  14. Applied add-cbrt-cube31.0

    \[\leadsto \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)}}} \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 \frac{x - y}{\mathsf{hypot}\left(x, y\right)}}\]
  15. Applied cbrt-undiv31.0

    \[\leadsto \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)}}}} \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 \frac{x - y}{\mathsf{hypot}\left(x, y\right)}}\]
  16. Applied cbrt-unprod31.0

    \[\leadsto \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)}} \cdot \left(\left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right) \cdot \frac{x - y}{\mathsf{hypot}\left(x, y\right)}\right)}}\]
  17. Simplified0.0

    \[\leadsto \sqrt[3]{\color{blue}{\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) \cdot \frac{\left(x - y\right) \cdot \frac{y + x}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)}}}\]
  18. 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 2019155 +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))))