Average Error: 9.8 → 9.8
Time: 1.6s
Precision: binary64
Cost: 960
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}
\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}
(FPCore (x)
 :precision binary64
 (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))
(FPCore (x)
 :precision binary64
 (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- 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 ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.8
Target0.3
Herbie9.8
\[\frac{2}{x \cdot \left(x \cdot x - 1\right)}\]

Derivation

  1. Initial program 9.8

    \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]

Reproduce

herbie shell --seed 2021027 
(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))))