Average Error: 0.0 → 0.1
Time: 3.7s
Precision: 64
\[\frac{x - y}{2 - \left(x + y\right)}\]
\[\left(x - y\right) \cdot \frac{1}{2 - \left(x + y\right)}\]
\frac{x - y}{2 - \left(x + y\right)}
\left(x - y\right) \cdot \frac{1}{2 - \left(x + y\right)}
double f(double x, double y) {
        double r826959 = x;
        double r826960 = y;
        double r826961 = r826959 - r826960;
        double r826962 = 2.0;
        double r826963 = r826959 + r826960;
        double r826964 = r826962 - r826963;
        double r826965 = r826961 / r826964;
        return r826965;
}

double f(double x, double y) {
        double r826966 = x;
        double r826967 = y;
        double r826968 = r826966 - r826967;
        double r826969 = 1.0;
        double r826970 = 2.0;
        double r826971 = r826966 + r826967;
        double r826972 = r826970 - r826971;
        double r826973 = r826969 / r826972;
        double r826974 = r826968 * r826973;
        return r826974;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.1
\[\frac{x}{2 - \left(x + y\right)} - \frac{y}{2 - \left(x + y\right)}\]

Derivation

  1. Initial program 0.0

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

    \[\leadsto \frac{x - y}{\color{blue}{\sqrt[3]{\left(\left(2 - \left(x + y\right)\right) \cdot \left(2 - \left(x + y\right)\right)\right) \cdot \left(2 - \left(x + y\right)\right)}}}\]
  4. Applied add-cbrt-cube42.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(\left(2 - \left(x + y\right)\right) \cdot \left(2 - \left(x + y\right)\right)\right) \cdot \left(2 - \left(x + y\right)\right)}}\]
  5. Applied cbrt-undiv42.2

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x - y\right) \cdot \left(x - y\right)\right) \cdot \left(x - y\right)}{\left(\left(2 - \left(x + y\right)\right) \cdot \left(2 - \left(x + y\right)\right)\right) \cdot \left(2 - \left(x + y\right)\right)}}}\]
  6. Simplified6.6

    \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{x - y}{2 - \left(x + y\right)}\right)}^{3}}}\]
  7. Using strategy rm
  8. Applied div-inv6.6

    \[\leadsto \sqrt[3]{{\color{blue}{\left(\left(x - y\right) \cdot \frac{1}{2 - \left(x + y\right)}\right)}}^{3}}\]
  9. Applied unpow-prod-down42.2

    \[\leadsto \sqrt[3]{\color{blue}{{\left(x - y\right)}^{3} \cdot {\left(\frac{1}{2 - \left(x + y\right)}\right)}^{3}}}\]
  10. Applied cbrt-prod42.4

    \[\leadsto \color{blue}{\sqrt[3]{{\left(x - y\right)}^{3}} \cdot \sqrt[3]{{\left(\frac{1}{2 - \left(x + y\right)}\right)}^{3}}}\]
  11. Simplified34.4

    \[\leadsto \color{blue}{\left(x - y\right)} \cdot \sqrt[3]{{\left(\frac{1}{2 - \left(x + y\right)}\right)}^{3}}\]
  12. Simplified0.1

    \[\leadsto \left(x - y\right) \cdot \color{blue}{\frac{1}{2 - \left(x + y\right)}}\]
  13. Final simplification0.1

    \[\leadsto \left(x - y\right) \cdot \frac{1}{2 - \left(x + y\right)}\]

Reproduce

herbie shell --seed 2020021 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
  :precision binary64

  :herbie-target
  (- (/ x (- 2 (+ x y))) (/ y (- 2 (+ x y))))

  (/ (- x y) (- 2 (+ x y))))