Average Error: 0.0 → 0.0
Time: 4.6s
Precision: 64
\[\frac{-\left(f + n\right)}{f - n}\]
\[\log \left(\frac{1}{e^{\frac{f + n}{f - n}}}\right)\]
\frac{-\left(f + n\right)}{f - n}
\log \left(\frac{1}{e^{\frac{f + n}{f - n}}}\right)
double f(double f, double n) {
        double r19531 = f;
        double r19532 = n;
        double r19533 = r19531 + r19532;
        double r19534 = -r19533;
        double r19535 = r19531 - r19532;
        double r19536 = r19534 / r19535;
        return r19536;
}

double f(double f, double n) {
        double r19537 = 1.0;
        double r19538 = f;
        double r19539 = n;
        double r19540 = r19538 + r19539;
        double r19541 = r19538 - r19539;
        double r19542 = r19540 / r19541;
        double r19543 = exp(r19542);
        double r19544 = r19537 / r19543;
        double r19545 = log(r19544);
        return r19545;
}

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 distribute-frac-neg0.0

    \[\leadsto \log \left(e^{\color{blue}{-\frac{f + n}{f - n}}}\right)\]
  6. Applied exp-neg0.0

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

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

Reproduce

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