Average Error: 0.0 → 0.0
Time: 19.6s
Precision: 64
\[\frac{-\left(f + n\right)}{f - n}\]
\[\frac{1}{\mathsf{log1p}\left(e^{\frac{f - n}{-\left(f + n\right)}} - 1\right)}\]
\frac{-\left(f + n\right)}{f - n}
\frac{1}{\mathsf{log1p}\left(e^{\frac{f - n}{-\left(f + n\right)}} - 1\right)}
double f(double f, double n) {
        double r33597 = f;
        double r33598 = n;
        double r33599 = r33597 + r33598;
        double r33600 = -r33599;
        double r33601 = r33597 - r33598;
        double r33602 = r33600 / r33601;
        return r33602;
}

double f(double f, double n) {
        double r33603 = 1.0;
        double r33604 = f;
        double r33605 = n;
        double r33606 = r33604 - r33605;
        double r33607 = r33604 + r33605;
        double r33608 = -r33607;
        double r33609 = r33606 / r33608;
        double r33610 = exp(r33609);
        double r33611 = r33610 - r33603;
        double r33612 = log1p(r33611);
        double r33613 = r33603 / r33612;
        return r33613;
}

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 clear-num0.0

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

    \[\leadsto \frac{1}{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{f - n}{-\left(f + n\right)}\right)\right)}}\]
  6. Using strategy rm
  7. Applied expm1-udef0.0

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

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

Reproduce

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