Average Error: 10.3 → 0.1
Time: 3.0s
Precision: binary64
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1} \]
\[\frac{\frac{\sqrt[3]{8}}{x}}{x \cdot x - 1} \]
\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}
\frac{\frac{\sqrt[3]{8}}{x}}{x \cdot x - 1}
(FPCore (x)
 :precision binary64
 (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))
(FPCore (x) :precision binary64 (/ (/ (cbrt 8.0) x) (- (* x x) 1.0)))
double code(double x) {
	return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0));
}
double code(double x) {
	return (cbrt(8.0) / x) / ((x * x) - 1.0);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.3
Target0.3
Herbie0.1
\[\frac{2}{x \cdot \left(x \cdot x - 1\right)} \]

Derivation

  1. Initial program 10.3

    \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1} \]
  2. Using strategy rm
  3. Applied frac-sub_binary6426.5

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

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

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

    \[\leadsto \frac{\left(x + -1\right) \cdot \left(x - \left(2 + x \cdot 2\right)\right) + \left(x + x \cdot x\right)}{\color{blue}{{x}^{3} - x}} \]
  7. Taylor expanded around 0 26.1

    \[\leadsto \frac{\color{blue}{\left(2 - \left({x}^{2} + x\right)\right)} + \left(x + x \cdot x\right)}{{x}^{3} - x} \]
  8. Simplified26.1

    \[\leadsto \frac{\color{blue}{\left(2 - \left(x + x \cdot x\right)\right)} + \left(x + x \cdot x\right)}{{x}^{3} - x} \]
  9. Using strategy rm
  10. Applied add-cbrt-cube_binary6426.1

    \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(\left(2 - \left(x + x \cdot x\right)\right) + \left(x + x \cdot x\right)\right) \cdot \left(\left(2 - \left(x + x \cdot x\right)\right) + \left(x + x \cdot x\right)\right)\right) \cdot \left(\left(2 - \left(x + x \cdot x\right)\right) + \left(x + x \cdot x\right)\right)}}}{{x}^{3} - x} \]
  11. Simplified0.3

    \[\leadsto \frac{\sqrt[3]{\color{blue}{8}}}{{x}^{3} - x} \]
  12. Using strategy rm
  13. Applied *-un-lft-identity_binary640.3

    \[\leadsto \frac{\sqrt[3]{8}}{{x}^{3} - \color{blue}{1 \cdot x}} \]
  14. Applied unpow3_binary640.3

    \[\leadsto \frac{\sqrt[3]{8}}{\color{blue}{\left(x \cdot x\right) \cdot x} - 1 \cdot x} \]
  15. Applied distribute-rgt-out--_binary640.3

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

    \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{8}}{x}}{x \cdot x - 1}} \]
  17. Final simplification0.1

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

Reproduce

herbie shell --seed 2021196 
(FPCore (x)
  :name "3frac (problem 3.3.3)"
  :precision binary64

  :herbie-target
  (/ 2.0 (* x (- (* x x) 1.0)))

  (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))