Average Error: 20.0 → 0.0
Time: 4.8s
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(\left(x + y\right) \cdot \frac{1}{\mathsf{hypot}\left(x, y\right) \cdot \frac{\mathsf{hypot}\left(x, y\right)}{x - y}}\right)}^{3}}\]
\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\sqrt[3]{{\left(\left(x + y\right) \cdot \frac{1}{\mathsf{hypot}\left(x, y\right) \cdot \frac{\mathsf{hypot}\left(x, y\right)}{x - y}}\right)}^{3}}
double f(double x, double y) {
        double r90192 = x;
        double r90193 = y;
        double r90194 = r90192 - r90193;
        double r90195 = r90192 + r90193;
        double r90196 = r90194 * r90195;
        double r90197 = r90192 * r90192;
        double r90198 = r90193 * r90193;
        double r90199 = r90197 + r90198;
        double r90200 = r90196 / r90199;
        return r90200;
}

double f(double x, double y) {
        double r90201 = x;
        double r90202 = y;
        double r90203 = r90201 + r90202;
        double r90204 = 1.0;
        double r90205 = hypot(r90201, r90202);
        double r90206 = r90201 - r90202;
        double r90207 = r90205 / r90206;
        double r90208 = r90205 * r90207;
        double r90209 = r90204 / r90208;
        double r90210 = r90203 * r90209;
        double r90211 = 3.0;
        double r90212 = pow(r90210, r90211);
        double r90213 = cbrt(r90212);
        return r90213;
}

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

    \[\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\]
  2. Using strategy rm
  3. Applied add-cbrt-cube47.1

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

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

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

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

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(\left(x - y\right) \cdot \left(x - y\right)\right) \cdot \left(x - y\right)\right) \cdot \left(\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + y\right)\right)}{\left(\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x + y \cdot y\right)\right) \cdot \left(x \cdot x + y \cdot y\right)}}}\]
  8. Simplified20.1

    \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{x + y}{\frac{\mathsf{fma}\left(x, x, y \cdot y\right)}{x - y}}\right)}^{3}}}\]
  9. Using strategy rm
  10. Applied div-inv20.1

    \[\leadsto \sqrt[3]{{\color{blue}{\left(\left(x + y\right) \cdot \frac{1}{\frac{\mathsf{fma}\left(x, x, y \cdot y\right)}{x - y}}\right)}}^{3}}\]
  11. Using strategy rm
  12. Applied *-un-lft-identity20.1

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020018 +o rules:numerics
(FPCore (x y)
  :name "Kahan p9 Example"
  :precision binary64
  :pre (and (< 0.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))))