Average Error: 0.0 → 0.0
Time: 6.4s
Precision: 64
\[\frac{-\left(f + n\right)}{f - n}\]
\[\log \left(\mathsf{log1p}\left(\mathsf{expm1}\left(e^{\frac{-\left(f + n\right)}{f - n}}\right)\right)\right)\]
\frac{-\left(f + n\right)}{f - n}
\log \left(\mathsf{log1p}\left(\mathsf{expm1}\left(e^{\frac{-\left(f + n\right)}{f - n}}\right)\right)\right)
double f(double f, double n) {
        double r64 = f;
        double r65 = n;
        double r66 = r64 + r65;
        double r67 = -r66;
        double r68 = r64 - r65;
        double r69 = r67 / r68;
        return r69;
}

double f(double f, double n) {
        double r70 = f;
        double r71 = n;
        double r72 = r70 + r71;
        double r73 = -r72;
        double r74 = r70 - r71;
        double r75 = r73 / r74;
        double r76 = exp(r75);
        double r77 = expm1(r76);
        double r78 = log1p(r77);
        double r79 = log(r78);
        return r79;
}

Error

Bits error versus f

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{-\left(f + n\right)}{f - n}\]
  2. Using strategy rm
  3. Applied add-log-exp0.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{-\left(f + n\right)}{f - n}}\right)}\]
  4. Using strategy rm
  5. Applied log1p-expm1-u0.0

    \[\leadsto \log \color{blue}{\left(\mathsf{log1p}\left(\mathsf{expm1}\left(e^{\frac{-\left(f + n\right)}{f - n}}\right)\right)\right)}\]
  6. Final simplification0.0

    \[\leadsto \log \left(\mathsf{log1p}\left(\mathsf{expm1}\left(e^{\frac{-\left(f + n\right)}{f - n}}\right)\right)\right)\]

Reproduce

herbie shell --seed 2020025 +o rules:numerics
(FPCore (f n)
  :name "subtraction fraction"
  :precision binary64
  (/ (- (+ f n)) (- f n)))