Average Error: 14.1 → 0.4
Time: 8.5s
Precision: binary64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\log \left(e^{-2}\right)}{-1 + x \cdot x}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\log \left(e^{-2}\right)}{-1 + x \cdot x}
(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
(FPCore (x) :precision binary64 (/ (log (exp -2.0)) (+ -1.0 (* x x))))
double code(double x) {
	return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
double code(double x) {
	return log(exp(-2.0)) / (-1.0 + (x * x));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.1

    \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied frac-sub_binary64_315613.6

    \[\leadsto \color{blue}{\frac{1 \cdot \left(x - 1\right) - \left(x + 1\right) \cdot 1}{\left(x + 1\right) \cdot \left(x - 1\right)}}\]
  4. Simplified13.5

    \[\leadsto \frac{\color{blue}{x + \left(-2 - x\right)}}{\left(x + 1\right) \cdot \left(x - 1\right)}\]
  5. Simplified13.5

    \[\leadsto \frac{x + \left(-2 - x\right)}{\color{blue}{-1 + x \cdot x}}\]
  6. Using strategy rm
  7. Applied add-log-exp_binary64_318631.4

    \[\leadsto \frac{x + \left(-2 - \color{blue}{\log \left(e^{x}\right)}\right)}{-1 + x \cdot x}\]
  8. Applied add-log-exp_binary64_318631.4

    \[\leadsto \frac{x + \left(\color{blue}{\log \left(e^{-2}\right)} - \log \left(e^{x}\right)\right)}{-1 + x \cdot x}\]
  9. Applied diff-log_binary64_323931.4

    \[\leadsto \frac{x + \color{blue}{\log \left(\frac{e^{-2}}{e^{x}}\right)}}{-1 + x \cdot x}\]
  10. Applied add-log-exp_binary64_318631.4

    \[\leadsto \frac{\color{blue}{\log \left(e^{x}\right)} + \log \left(\frac{e^{-2}}{e^{x}}\right)}{-1 + x \cdot x}\]
  11. Applied sum-log_binary64_323831.4

    \[\leadsto \frac{\color{blue}{\log \left(e^{x} \cdot \frac{e^{-2}}{e^{x}}\right)}}{-1 + x \cdot x}\]
  12. Simplified0.4

    \[\leadsto \frac{\log \color{blue}{\left(e^{-2}\right)}}{-1 + x \cdot x}\]
  13. Final simplification0.4

    \[\leadsto \frac{\log \left(e^{-2}\right)}{-1 + x \cdot x}\]

Reproduce

herbie shell --seed 2021007 
(FPCore (x)
  :name "Asymptote A"
  :precision binary64
  (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))