Average Error: 0.0 → 0.0
Time: 4.5s
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 r21249 = f;
        double r21250 = n;
        double r21251 = r21249 + r21250;
        double r21252 = -r21251;
        double r21253 = r21249 - r21250;
        double r21254 = r21252 / r21253;
        return r21254;
}

double f(double f, double n) {
        double r21255 = f;
        double r21256 = n;
        double r21257 = r21255 + r21256;
        double r21258 = -r21257;
        double r21259 = r21255 - r21256;
        double r21260 = r21258 / r21259;
        double r21261 = exp(r21260);
        double r21262 = expm1(r21261);
        double r21263 = log1p(r21262);
        double r21264 = log(r21263);
        return r21264;
}

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)))