Average Error: 0.0 → 0.1
Time: 28.7s
Precision: 64
\[\frac{x}{y + x}\]
\[\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{log1p}\left(\frac{x}{y + x}\right)\right)\right)\right)\]
\frac{x}{y + x}
\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{log1p}\left(\frac{x}{y + x}\right)\right)\right)\right)
double f(double x, double y) {
        double r13800707 = x;
        double r13800708 = y;
        double r13800709 = r13800708 + r13800707;
        double r13800710 = r13800707 / r13800709;
        return r13800710;
}

double f(double x, double y) {
        double r13800711 = x;
        double r13800712 = y;
        double r13800713 = r13800712 + r13800711;
        double r13800714 = r13800711 / r13800713;
        double r13800715 = log1p(r13800714);
        double r13800716 = log1p(r13800715);
        double r13800717 = expm1(r13800716);
        double r13800718 = expm1(r13800717);
        return r13800718;
}

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. Using strategy rm
  5. Applied expm1-log1p-u0.1

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

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

Reproduce

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