Average Error: 0.0 → 0.1
Time: 1.2m
Precision: 64
\[\frac{x - y}{2 - \left(x + y\right)}\]
\[\frac{1}{2 - \left(y + x\right)} \cdot x - \frac{y}{2 - \left(y + x\right)}\]
\frac{x - y}{2 - \left(x + y\right)}
\frac{1}{2 - \left(y + x\right)} \cdot x - \frac{y}{2 - \left(y + x\right)}
double f(double x, double y) {
        double r38606164 = x;
        double r38606165 = y;
        double r38606166 = r38606164 - r38606165;
        double r38606167 = 2.0;
        double r38606168 = r38606164 + r38606165;
        double r38606169 = r38606167 - r38606168;
        double r38606170 = r38606166 / r38606169;
        return r38606170;
}

double f(double x, double y) {
        double r38606171 = 1.0;
        double r38606172 = 2.0;
        double r38606173 = y;
        double r38606174 = x;
        double r38606175 = r38606173 + r38606174;
        double r38606176 = r38606172 - r38606175;
        double r38606177 = r38606171 / r38606176;
        double r38606178 = r38606177 * r38606174;
        double r38606179 = r38606173 / r38606176;
        double r38606180 = r38606178 - r38606179;
        return r38606180;
}

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

    \[\leadsto \color{blue}{\frac{x}{2 - \left(x + y\right)} - \frac{y}{2 - \left(x + y\right)}}\]
  4. Using strategy rm
  5. Applied div-inv0.1

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

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

Reproduce

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

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

  (/ (- x y) (- 2.0 (+ x y))))