Average Error: 0.0 → 0.0
Time: 10.0s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\left(\left(-\frac{y}{x - y}\right) \cdot \frac{x - y}{y + x} + \frac{x - y}{y + x} \cdot \frac{y}{x - y}\right) + \left(\frac{x}{y + x} - \frac{x - y}{y + x} \cdot \frac{y}{x - y}\right)\]
\frac{x - y}{x + y}
\left(\left(-\frac{y}{x - y}\right) \cdot \frac{x - y}{y + x} + \frac{x - y}{y + x} \cdot \frac{y}{x - y}\right) + \left(\frac{x}{y + x} - \frac{x - y}{y + x} \cdot \frac{y}{x - y}\right)
double f(double x, double y) {
        double r32316264 = x;
        double r32316265 = y;
        double r32316266 = r32316264 - r32316265;
        double r32316267 = r32316264 + r32316265;
        double r32316268 = r32316266 / r32316267;
        return r32316268;
}

double f(double x, double y) {
        double r32316269 = y;
        double r32316270 = x;
        double r32316271 = r32316270 - r32316269;
        double r32316272 = r32316269 / r32316271;
        double r32316273 = -r32316272;
        double r32316274 = r32316269 + r32316270;
        double r32316275 = r32316271 / r32316274;
        double r32316276 = r32316273 * r32316275;
        double r32316277 = r32316275 * r32316272;
        double r32316278 = r32316276 + r32316277;
        double r32316279 = r32316270 / r32316274;
        double r32316280 = r32316279 - r32316277;
        double r32316281 = r32316278 + r32316280;
        return r32316281;
}

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 flip-+18.9

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

    \[\leadsto \frac{x}{x + y} - \color{blue}{\frac{y}{x \cdot x - y \cdot y} \cdot \left(x - y\right)}\]
  7. Applied *-un-lft-identity19.0

    \[\leadsto \frac{x}{\color{blue}{1 \cdot \left(x + y\right)}} - \frac{y}{x \cdot x - y \cdot y} \cdot \left(x - y\right)\]
  8. Applied add-sqr-sqrt41.2

    \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{1 \cdot \left(x + y\right)} - \frac{y}{x \cdot x - y \cdot y} \cdot \left(x - y\right)\]
  9. Applied times-frac41.2

    \[\leadsto \color{blue}{\frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{x + y}} - \frac{y}{x \cdot x - y \cdot y} \cdot \left(x - y\right)\]
  10. Applied prod-diff41.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt{x}}{1}, \frac{\sqrt{x}}{x + y}, -\left(x - y\right) \cdot \frac{y}{x \cdot x - y \cdot y}\right) + \mathsf{fma}\left(-\left(x - y\right), \frac{y}{x \cdot x - y \cdot y}, \left(x - y\right) \cdot \frac{y}{x \cdot x - y \cdot y}\right)}\]
  11. Simplified7.3

    \[\leadsto \color{blue}{\left(\frac{x}{x + y} - \frac{x - y}{x + y} \cdot \frac{y}{x - y}\right)} + \mathsf{fma}\left(-\left(x - y\right), \frac{y}{x \cdot x - y \cdot y}, \left(x - y\right) \cdot \frac{y}{x \cdot x - y \cdot y}\right)\]
  12. Simplified0.0

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

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

Reproduce

herbie shell --seed 2019162 +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)))