Average Error: 0.0 → 0.0
Time: 4.3s
Precision: binary64
\[\frac{-\left(f + n\right)}{f - n}\]
\[\log \left(e^{\frac{n + f}{n - f}}\right)\]
\frac{-\left(f + n\right)}{f - n}
\log \left(e^{\frac{n + f}{n - f}}\right)
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
(FPCore (f n) :precision binary64 (log (exp (/ (+ n f) (- n f)))))
double code(double f, double n) {
	return -(f + n) / (f - n);
}
double code(double f, double n) {
	return log(exp((n + f) / (n - f)));
}

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{f + n}{n - f}}\]
  3. Using strategy rm
  4. Applied add-log-exp_binary640.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{f + n}{n - f}}\right)}\]
  5. Simplified0.0

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

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

Reproduce

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