Average Error: 0.0 → 0.0
Time: 14.6s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{y + x} - \frac{y}{y + x}\right)\right)\]
\frac{x - y}{x + y}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{y + x} - \frac{y}{y + x}\right)\right)
double f(double x, double y) {
        double r38639150 = x;
        double r38639151 = y;
        double r38639152 = r38639150 - r38639151;
        double r38639153 = r38639150 + r38639151;
        double r38639154 = r38639152 / r38639153;
        return r38639154;
}

double f(double x, double y) {
        double r38639155 = x;
        double r38639156 = y;
        double r38639157 = r38639156 + r38639155;
        double r38639158 = r38639155 / r38639157;
        double r38639159 = r38639156 / r38639157;
        double r38639160 = r38639158 - r38639159;
        double r38639161 = expm1(r38639160);
        double r38639162 = log1p(r38639161);
        return r38639162;
}

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

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

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

Reproduce

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