Average Error: 0.0 → 0.0
Time: 10.2s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x - y}{x + y}\right)\right)\]
\frac{x - y}{x + y}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x - y}{x + y}\right)\right)
double f(double x, double y) {
        double r571423 = x;
        double r571424 = y;
        double r571425 = r571423 - r571424;
        double r571426 = r571423 + r571424;
        double r571427 = r571425 / r571426;
        return r571427;
}

double f(double x, double y) {
        double r571428 = x;
        double r571429 = y;
        double r571430 = r571428 - r571429;
        double r571431 = r571428 + r571429;
        double r571432 = r571430 / r571431;
        double r571433 = expm1(r571432);
        double r571434 = log1p(r571433);
        return r571434;
}

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

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

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

Reproduce

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