Average Error: 0.0 → 0.0
Time: 2.0s
Precision: binary64
\[\frac{x - y}{x + y} \]
\[\frac{x - y}{x + y} \]
\frac{x - y}{x + y}
\frac{x - y}{x + y}
(FPCore (x y) :precision binary64 (/ (- x y) (+ x y)))
(FPCore (x y) :precision binary64 (/ (- x y) (+ x y)))
double code(double x, double y) {
	return (x - y) / (x + y);
}
double code(double x, double y) {
	return (x - y) / (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. Applied *-un-lft-identity_binary640.0

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{x - y}}{1} \cdot \frac{\sqrt{x - y}}{x + y}} \]
  5. Simplified32.2

    \[\leadsto \color{blue}{\sqrt{x - y}} \cdot \frac{\sqrt{x - y}}{x + y} \]
  6. Applied *-un-lft-identity_binary6432.2

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

    \[\leadsto \color{blue}{\left(\sqrt{1} \cdot \sqrt{x - y}\right)} \cdot \frac{\sqrt{x - y}}{x + y} \]
  8. Applied associate-*l*_binary6432.2

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

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

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

Reproduce

herbie shell --seed 2022068 
(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)))