Average Error: 0.0 → 0.0
Time: 3.4s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\frac{-\left(x - y\right)}{-\left(x + y\right)}\]
\frac{x - y}{x + y}
\frac{-\left(x - y\right)}{-\left(x + y\right)}
double code(double x, double y) {
	return ((double) (((double) (x - y)) / ((double) (x + y))));
}
double code(double x, double y) {
	return ((double) (((double) -(((double) (x - y)))) / ((double) -(((double) (x + y))))));
}

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 frac-2neg0.0

    \[\leadsto \frac{x}{x + y} - \color{blue}{\frac{-y}{-\left(x + y\right)}}\]
  6. Applied frac-2neg0.0

    \[\leadsto \color{blue}{\frac{-x}{-\left(x + y\right)}} - \frac{-y}{-\left(x + y\right)}\]
  7. Applied sub-div0.0

    \[\leadsto \color{blue}{\frac{\left(-x\right) - \left(-y\right)}{-\left(x + y\right)}}\]
  8. Simplified0.0

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

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

Reproduce

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