Average Error: 0.0 → 0.0
Time: 4.2s
Precision: 64
\[\frac{x - y}{2 - \left(x + y\right)}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{2 - \left(x + y\right)}\right)\right) - \frac{y}{2 - \left(x + y\right)}\]
\frac{x - y}{2 - \left(x + y\right)}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{2 - \left(x + y\right)}\right)\right) - \frac{y}{2 - \left(x + y\right)}
double f(double x, double y) {
        double r992826 = x;
        double r992827 = y;
        double r992828 = r992826 - r992827;
        double r992829 = 2.0;
        double r992830 = r992826 + r992827;
        double r992831 = r992829 - r992830;
        double r992832 = r992828 / r992831;
        return r992832;
}

double f(double x, double y) {
        double r992833 = x;
        double r992834 = 2.0;
        double r992835 = y;
        double r992836 = r992833 + r992835;
        double r992837 = r992834 - r992836;
        double r992838 = r992833 / r992837;
        double r992839 = expm1(r992838);
        double r992840 = log1p(r992839);
        double r992841 = r992835 / r992837;
        double r992842 = r992840 - r992841;
        return r992842;
}

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 - \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 div-sub0.0

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

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

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

Reproduce

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

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

  (/ (- x y) (- 2 (+ x y))))