Average Error: 29.5 → 0.1
Time: 3.3s
Precision: binary64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\frac{\frac{-1 - 3 \cdot x}{x + 1}}{-1 + x}\]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\frac{\frac{-1 - 3 \cdot x}{x + 1}}{-1 + x}
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
 :precision binary64
 (/ (/ (- -1.0 (* 3.0 x)) (+ x 1.0)) (+ -1.0 x)))
double code(double x) {
	return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
	return ((-1.0 - (3.0 * x)) / (x + 1.0)) / (-1.0 + x);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 29.5

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

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

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

    \[\leadsto \frac{\left(x \cdot x - x\right) - \left(1 + x\right) \cdot \left(1 + x\right)}{\color{blue}{x \cdot x + -1}}\]
  6. Taylor expanded around 0 15.3

    \[\leadsto \frac{\color{blue}{-\left(3 \cdot x + 1\right)}}{x \cdot x + -1}\]
  7. Simplified15.3

    \[\leadsto \frac{\color{blue}{-1 - 3 \cdot x}}{x \cdot x + -1}\]
  8. Using strategy rm
  9. Applied difference-of-sqr--1_binary6415.3

    \[\leadsto \frac{-1 - 3 \cdot x}{\color{blue}{\left(x + 1\right) \cdot \left(x - 1\right)}}\]
  10. Applied associate-/r*_binary640.1

    \[\leadsto \color{blue}{\frac{\frac{-1 - 3 \cdot x}{x + 1}}{x - 1}}\]
  11. Simplified0.1

    \[\leadsto \frac{\color{blue}{\frac{-1 - 3 \cdot x}{1 + x}}}{x - 1}\]
  12. Final simplification0.1

    \[\leadsto \frac{\frac{-1 - 3 \cdot x}{x + 1}}{-1 + x}\]

Reproduce

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