Average Error: 0.0 → 0.0
Time: 2.9s
Precision: 64
\[\frac{x - y}{x + y}\]
\[\log \left(1 + \mathsf{expm1}\left(\frac{x - y}{x + y}\right)\right)\]
\frac{x - y}{x + y}
\log \left(1 + \mathsf{expm1}\left(\frac{x - y}{x + y}\right)\right)
double f(double x, double y) {
        double r819203 = x;
        double r819204 = y;
        double r819205 = r819203 - r819204;
        double r819206 = r819203 + r819204;
        double r819207 = r819205 / r819206;
        return r819207;
}

double f(double x, double y) {
        double r819208 = 1.0;
        double r819209 = x;
        double r819210 = y;
        double r819211 = r819209 - r819210;
        double r819212 = r819209 + r819210;
        double r819213 = r819211 / r819212;
        double r819214 = expm1(r819213);
        double r819215 = r819208 + r819214;
        double r819216 = log(r819215);
        return r819216;
}

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. Using strategy rm
  5. Applied log1p-udef0.0

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

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

Reproduce

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