Average Error: 0.0 → 0.0
Time: 16.1s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\log \left(e^{\frac{x}{y + x}}\right) - \log \left(e^{\frac{y}{y + x}}\right)\]
\frac{x - y}{x + y}
\log \left(e^{\frac{x}{y + x}}\right) - \log \left(e^{\frac{y}{y + x}}\right)
double f(double x, double y) {
        double r37853018 = x;
        double r37853019 = y;
        double r37853020 = r37853018 - r37853019;
        double r37853021 = r37853018 + r37853019;
        double r37853022 = r37853020 / r37853021;
        return r37853022;
}

double f(double x, double y) {
        double r37853023 = x;
        double r37853024 = y;
        double r37853025 = r37853024 + r37853023;
        double r37853026 = r37853023 / r37853025;
        double r37853027 = exp(r37853026);
        double r37853028 = log(r37853027);
        double r37853029 = r37853024 / r37853025;
        double r37853030 = exp(r37853029);
        double r37853031 = log(r37853030);
        double r37853032 = r37853028 - r37853031;
        return r37853032;
}

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

    \[\leadsto \color{blue}{\log \left(e^{\frac{x}{x + y}}\right)} - \frac{y}{x + y}\]
  6. Using strategy rm
  7. Applied add-log-exp0.0

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

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

Reproduce

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