Average Error: 0.0 → 0.1
Time: 13.7s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\frac{x}{y + x} - \frac{1}{y + x} \cdot y\]
\frac{x - y}{x + y}
\frac{x}{y + x} - \frac{1}{y + x} \cdot y
double f(double x, double y) {
        double r35972334 = x;
        double r35972335 = y;
        double r35972336 = r35972334 - r35972335;
        double r35972337 = r35972334 + r35972335;
        double r35972338 = r35972336 / r35972337;
        return r35972338;
}

double f(double x, double y) {
        double r35972339 = x;
        double r35972340 = y;
        double r35972341 = r35972340 + r35972339;
        double r35972342 = r35972339 / r35972341;
        double r35972343 = 1.0;
        double r35972344 = r35972343 / r35972341;
        double r35972345 = r35972344 * r35972340;
        double r35972346 = r35972342 - r35972345;
        return r35972346;
}

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}{x + y} - \frac{y}{x + y}\]

Derivation

  1. Initial program 0.0

    \[\frac{x - y}{x + y}\]
  2. Using strategy rm
  3. Applied div-sub0.0

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

    \[\leadsto \frac{x}{x + y} - \color{blue}{y \cdot \frac{1}{x + y}}\]
  6. Final simplification0.1

    \[\leadsto \frac{x}{y + x} - \frac{1}{y + x} \cdot y\]

Reproduce

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

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

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