Average Error: 0.0 → 0.0
Time: 3.6s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right) + \frac{1}{2} \cdot \frac{x - y}{x + y}\]
\frac{x - y}{x + y}
\log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right) + \frac{1}{2} \cdot \frac{x - y}{x + y}
double f(double x, double y) {
        double r885869 = x;
        double r885870 = y;
        double r885871 = r885869 - r885870;
        double r885872 = r885869 + r885870;
        double r885873 = r885871 / r885872;
        return r885873;
}

double f(double x, double y) {
        double r885874 = x;
        double r885875 = y;
        double r885876 = r885874 - r885875;
        double r885877 = r885874 + r885875;
        double r885878 = r885876 / r885877;
        double r885879 = exp(r885878);
        double r885880 = sqrt(r885879);
        double r885881 = log(r885880);
        double r885882 = 0.5;
        double r885883 = r885882 * r885878;
        double r885884 = r885881 + r885883;
        return r885884;
}

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 add-log-exp0.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{x - y}{x + y}}\right)}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt0.0

    \[\leadsto \log \color{blue}{\left(\sqrt{e^{\frac{x - y}{x + y}}} \cdot \sqrt{e^{\frac{x - y}{x + y}}}\right)}\]
  6. Applied log-prod0.0

    \[\leadsto \color{blue}{\log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right) + \log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right)}\]
  7. Using strategy rm
  8. Applied pow1/20.0

    \[\leadsto \log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right) + \log \color{blue}{\left({\left(e^{\frac{x - y}{x + y}}\right)}^{\frac{1}{2}}\right)}\]
  9. Applied log-pow0.0

    \[\leadsto \log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right) + \color{blue}{\frac{1}{2} \cdot \log \left(e^{\frac{x - y}{x + y}}\right)}\]
  10. Simplified0.0

    \[\leadsto \log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right) + \frac{1}{2} \cdot \color{blue}{\frac{x - y}{x + y}}\]
  11. Final simplification0.0

    \[\leadsto \log \left(\sqrt{e^{\frac{x - y}{x + y}}}\right) + \frac{1}{2} \cdot \frac{x - y}{x + y}\]

Reproduce

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