Average Error: 0.0 → 0.0
Time: 4.1s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\log \left(e^{\frac{x}{x + y}}\right) - \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{x + y}\right)\right)\]
\frac{x - y}{x + y}
\log \left(e^{\frac{x}{x + y}}\right) - \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{x + y}\right)\right)
double f(double x, double y) {
        double r731518 = x;
        double r731519 = y;
        double r731520 = r731518 - r731519;
        double r731521 = r731518 + r731519;
        double r731522 = r731520 / r731521;
        return r731522;
}

double f(double x, double y) {
        double r731523 = x;
        double r731524 = y;
        double r731525 = r731523 + r731524;
        double r731526 = r731523 / r731525;
        double r731527 = exp(r731526);
        double r731528 = log(r731527);
        double r731529 = r731524 / r731525;
        double r731530 = log1p(r731529);
        double r731531 = expm1(r731530);
        double r731532 = r731528 - r731531;
        return r731532;
}

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 expm1-log1p-u0.0

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

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

Reproduce

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