Average Error: 0.0 → 0.0
Time: 8.9s
Precision: 64
\[\frac{x}{y + x}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y + x}\right)\right)\]
\frac{x}{y + x}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y + x}\right)\right)
double f(double x, double y) {
        double r15359321 = x;
        double r15359322 = y;
        double r15359323 = r15359322 + r15359321;
        double r15359324 = r15359321 / r15359323;
        return r15359324;
}

double f(double x, double y) {
        double r15359325 = x;
        double r15359326 = y;
        double r15359327 = r15359326 + r15359325;
        double r15359328 = r15359325 / r15359327;
        double r15359329 = log1p(r15359328);
        double r15359330 = expm1(r15359329);
        return r15359330;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{x}{y + x}\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.0

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

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

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y)
  :name "AI.Clustering.Hierarchical.Internal:average from clustering-0.2.1, B"
  (/ x (+ y x)))