Average Error: 0.0 → 0.0
Time: 17.5s
Precision: 64
\[\frac{-\left(f + n\right)}{f - n}\]
\[\log \left(\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\frac{-\left(f + n\right)}{f - n}}\right)\right)\right)\]
\frac{-\left(f + n\right)}{f - n}
\log \left(\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\frac{-\left(f + n\right)}{f - n}}\right)\right)\right)
double f(double f, double n) {
        double r27984 = f;
        double r27985 = n;
        double r27986 = r27984 + r27985;
        double r27987 = -r27986;
        double r27988 = r27984 - r27985;
        double r27989 = r27987 / r27988;
        return r27989;
}

double f(double f, double n) {
        double r27990 = f;
        double r27991 = n;
        double r27992 = r27990 + r27991;
        double r27993 = -r27992;
        double r27994 = r27990 - r27991;
        double r27995 = r27993 / r27994;
        double r27996 = exp(r27995);
        double r27997 = log1p(r27996);
        double r27998 = expm1(r27997);
        double r27999 = log(r27998);
        return r27999;
}

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 expm1-log1p-u0.0

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

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

Reproduce

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