Average Error: 0.0 → 0.0
Time: 13.8s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\frac{1}{\frac{x + y}{x}} - \frac{y}{x + y}\]
\frac{x - y}{x + y}
\frac{1}{\frac{x + y}{x}} - \frac{y}{x + y}
double f(double x, double y) {
        double r476885 = x;
        double r476886 = y;
        double r476887 = r476885 - r476886;
        double r476888 = r476885 + r476886;
        double r476889 = r476887 / r476888;
        return r476889;
}

double f(double x, double y) {
        double r476890 = 1.0;
        double r476891 = x;
        double r476892 = y;
        double r476893 = r476891 + r476892;
        double r476894 = r476893 / r476891;
        double r476895 = r476890 / r476894;
        double r476896 = r476892 / r476893;
        double r476897 = r476895 - r476896;
        return r476897;
}

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.0
\[\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 clear-num0.0

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

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

Reproduce

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

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

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