Average Error: 0.0 → 0.9
Time: 15.9s
Precision: 64
\[\frac{x - y}{2 - \left(x + y\right)}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x - y}{2 - \left(y + x\right)}\right)\right)\]
\frac{x - y}{2 - \left(x + y\right)}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x - y}{2 - \left(y + x\right)}\right)\right)
double f(double x, double y) {
        double r38450500 = x;
        double r38450501 = y;
        double r38450502 = r38450500 - r38450501;
        double r38450503 = 2.0;
        double r38450504 = r38450500 + r38450501;
        double r38450505 = r38450503 - r38450504;
        double r38450506 = r38450502 / r38450505;
        return r38450506;
}

double f(double x, double y) {
        double r38450507 = x;
        double r38450508 = y;
        double r38450509 = r38450507 - r38450508;
        double r38450510 = 2.0;
        double r38450511 = r38450508 + r38450507;
        double r38450512 = r38450510 - r38450511;
        double r38450513 = r38450509 / r38450512;
        double r38450514 = log1p(r38450513);
        double r38450515 = expm1(r38450514);
        return r38450515;
}

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.9
\[\frac{x}{2 - \left(x + y\right)} - \frac{y}{2 - \left(x + y\right)}\]

Derivation

  1. Initial program 0.0

    \[\frac{x - y}{2 - \left(x + y\right)}\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.9

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x - y}{2 - \left(x + y\right)}\right)\right)}\]
  4. Final simplification0.9

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

Reproduce

herbie shell --seed 2019192 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, C"

  :herbie-target
  (- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))

  (/ (- x y) (- 2.0 (+ x y))))