Average Error: 0.0 → 0.0
Time: 11.0s
Precision: 64
\[\frac{-\left(f + n\right)}{f - n}\]
\[\frac{-1}{\log \left(e^{\frac{f}{n + f}}\right) - \frac{n}{n + f}}\]
\frac{-\left(f + n\right)}{f - n}
\frac{-1}{\log \left(e^{\frac{f}{n + f}}\right) - \frac{n}{n + f}}
double f(double f, double n) {
        double r22255 = f;
        double r22256 = n;
        double r22257 = r22255 + r22256;
        double r22258 = -r22257;
        double r22259 = r22255 - r22256;
        double r22260 = r22258 / r22259;
        return r22260;
}

double f(double f, double n) {
        double r22261 = -1.0;
        double r22262 = f;
        double r22263 = n;
        double r22264 = r22263 + r22262;
        double r22265 = r22262 / r22264;
        double r22266 = exp(r22265);
        double r22267 = log(r22266);
        double r22268 = r22263 / r22264;
        double r22269 = r22267 - r22268;
        double r22270 = r22261 / r22269;
        return r22270;
}

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. Simplified0.0

    \[\leadsto \color{blue}{\frac{-\left(n + f\right)}{f - n}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.0

    \[\leadsto \frac{-\color{blue}{1 \cdot \left(n + f\right)}}{f - n}\]
  5. Applied distribute-lft-neg-in0.0

    \[\leadsto \frac{\color{blue}{\left(-1\right) \cdot \left(n + f\right)}}{f - n}\]
  6. Applied associate-/l*0.0

    \[\leadsto \color{blue}{\frac{-1}{\frac{f - n}{n + f}}}\]
  7. Using strategy rm
  8. Applied div-sub0.0

    \[\leadsto \frac{-1}{\color{blue}{\frac{f}{n + f} - \frac{n}{n + f}}}\]
  9. Using strategy rm
  10. Applied add-log-exp0.0

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

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

Reproduce

herbie shell --seed 2019179 
(FPCore (f n)
  :name "subtraction fraction"
  (/ (- (+ f n)) (- f n)))