Average Error: 0.0 → 0.0
Time: 28.4s
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 r46646 = f;
        double r46647 = n;
        double r46648 = r46646 + r46647;
        double r46649 = -r46648;
        double r46650 = r46646 - r46647;
        double r46651 = r46649 / r46650;
        return r46651;
}

double f(double f, double n) {
        double r46652 = 1.0;
        double r46653 = f;
        double r46654 = n;
        double r46655 = r46653 - r46654;
        double r46656 = r46653 + r46654;
        double r46657 = -r46656;
        double r46658 = r46655 / r46657;
        double r46659 = exp(r46658);
        double r46660 = r46659 - r46652;
        double r46661 = log1p(r46660);
        double r46662 = r46652 / r46661;
        return r46662;
}

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