Average Error: 15.4 → 15.4
Time: 1.5s
Precision: binary64
\[\frac{x}{x \cdot x + 1}\]
\[x \cdot \frac{1}{1 + x \cdot x}\]
\frac{x}{x \cdot x + 1}
x \cdot \frac{1}{1 + x \cdot x}
(FPCore (x) :precision binary64 (/ x (+ (* x x) 1.0)))
(FPCore (x) :precision binary64 (* x (/ 1.0 (+ 1.0 (* x x)))))
double code(double x) {
	return x / ((x * x) + 1.0);
}
double code(double x) {
	return x * (1.0 / (1.0 + (x * x)));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.4
Target0.1
Herbie15.4
\[\frac{1}{x + \frac{1}{x}}\]

Derivation

  1. Initial program 15.4

    \[\frac{x}{x \cdot x + 1}\]
  2. Using strategy rm
  3. Applied div-inv_binary64_185315.4

    \[\leadsto \color{blue}{x \cdot \frac{1}{x \cdot x + 1}}\]
  4. Final simplification15.4

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

Reproduce

herbie shell --seed 2020277 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ x (/ 1.0 x)))

  (/ x (+ (* x x) 1.0)))