Average Error: 0.0 → 0.0
Time: 4.6s
Precision: binary64
\[\frac{-\left(f + n\right)}{f - n} \]
\[\frac{1}{\log \left(e^{\frac{n - f}{n + f}}\right)} \]
\frac{-\left(f + n\right)}{f - n}
\frac{1}{\log \left(e^{\frac{n - f}{n + f}}\right)}
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
(FPCore (f n) :precision binary64 (/ 1.0 (log (exp (/ (- n f) (+ n f))))))
double code(double f, double n) {
	return -(f + n) / (f - n);
}
double code(double f, double n) {
	return 1.0 / 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. Applied clear-num_binary640.0

    \[\leadsto \color{blue}{\frac{1}{\frac{n - f}{f + n}}} \]
  4. Applied add-log-exp_binary640.0

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

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

Reproduce

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