Average Error: 0.0 → 0.0
Time: 2.3s
Precision: 64
\[\frac{x + y}{x - y}\]
\[\frac{x}{x - y} + \frac{y}{x - y}\]
\frac{x + y}{x - y}
\frac{x}{x - y} + \frac{y}{x - y}
double f(double x, double y) {
        double r532741 = x;
        double r532742 = y;
        double r532743 = r532741 + r532742;
        double r532744 = r532741 - r532742;
        double r532745 = r532743 / r532744;
        return r532745;
}

double f(double x, double y) {
        double r532746 = x;
        double r532747 = y;
        double r532748 = r532746 - r532747;
        double r532749 = r532746 / r532748;
        double r532750 = r532747 / r532748;
        double r532751 = r532749 + r532750;
        return r532751;
}

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{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 flip--31.2

    \[\leadsto \frac{x + y}{\color{blue}{\frac{x \cdot x - y \cdot y}{x + y}}}\]
  4. Applied associate-/r/31.3

    \[\leadsto \color{blue}{\frac{x + y}{x \cdot x - y \cdot y} \cdot \left(x + y\right)}\]
  5. Simplified0.2

    \[\leadsto \color{blue}{\frac{1}{x - y}} \cdot \left(x + y\right)\]
  6. Using strategy rm
  7. Applied distribute-lft-in0.2

    \[\leadsto \color{blue}{\frac{1}{x - y} \cdot x + \frac{1}{x - y} \cdot y}\]
  8. Simplified0.1

    \[\leadsto \color{blue}{\frac{x}{x - y}} + \frac{1}{x - y} \cdot y\]
  9. Simplified0.0

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

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

Reproduce

herbie shell --seed 2020081 +o rules:numerics
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, A"
  :precision binary64

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

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