Average Error: 0.0 → 0.0
Time: 18.1s
Precision: 64
\[\frac{x - y}{2.0 - \left(x + y\right)}\]
\[\frac{x}{2.0 - \left(x + y\right)} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{y}{2.0 - \left(x + y\right)}\right)\right)\]
\frac{x - y}{2.0 - \left(x + y\right)}
\frac{x}{2.0 - \left(x + y\right)} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{y}{2.0 - \left(x + y\right)}\right)\right)
double f(double x, double y) {
        double r42353107 = x;
        double r42353108 = y;
        double r42353109 = r42353107 - r42353108;
        double r42353110 = 2.0;
        double r42353111 = r42353107 + r42353108;
        double r42353112 = r42353110 - r42353111;
        double r42353113 = r42353109 / r42353112;
        return r42353113;
}

double f(double x, double y) {
        double r42353114 = x;
        double r42353115 = 2.0;
        double r42353116 = y;
        double r42353117 = r42353114 + r42353116;
        double r42353118 = r42353115 - r42353117;
        double r42353119 = r42353114 / r42353118;
        double r42353120 = r42353116 / r42353118;
        double r42353121 = expm1(r42353120);
        double r42353122 = log1p(r42353121);
        double r42353123 = r42353119 - r42353122;
        return r42353123;
}

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

Derivation

  1. Initial program 0.0

    \[\frac{x - y}{2.0 - \left(x + y\right)}\]
  2. Using strategy rm
  3. Applied div-sub0.0

    \[\leadsto \color{blue}{\frac{x}{2.0 - \left(x + y\right)} - \frac{y}{2.0 - \left(x + y\right)}}\]
  4. Using strategy rm
  5. Applied log1p-expm1-u0.0

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

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

Reproduce

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