Average Error: 0.4 → 0.2
Time: 9.6s
Precision: 64
\[\frac{x \cdot 100}{x + y}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{\frac{y + x}{100}}\right)\right)\]
\frac{x \cdot 100}{x + y}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{\frac{y + x}{100}}\right)\right)
double f(double x, double y) {
        double r31793161 = x;
        double r31793162 = 100.0;
        double r31793163 = r31793161 * r31793162;
        double r31793164 = y;
        double r31793165 = r31793161 + r31793164;
        double r31793166 = r31793163 / r31793165;
        return r31793166;
}

double f(double x, double y) {
        double r31793167 = x;
        double r31793168 = y;
        double r31793169 = r31793168 + r31793167;
        double r31793170 = 100.0;
        double r31793171 = r31793169 / r31793170;
        double r31793172 = r31793167 / r31793171;
        double r31793173 = expm1(r31793172);
        double r31793174 = log1p(r31793173);
        return r31793174;
}

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.4
Target0.2
Herbie0.2
\[\frac{x}{1} \cdot \frac{100}{x + y}\]

Derivation

  1. Initial program 0.4

    \[\frac{x \cdot 100}{x + y}\]
  2. Using strategy rm
  3. Applied associate-/l*0.2

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

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

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

Reproduce

herbie shell --seed 2019171 +o rules:numerics
(FPCore (x y)
  :name "Development.Shake.Progress:message from shake-0.15.5"

  :herbie-target
  (* (/ x 1.0) (/ 100.0 (+ x y)))

  (/ (* x 100.0) (+ x y)))