Average Error: 0.2 → 0.0
Time: 3.8s
Precision: 64
\[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\]
\[6 \cdot \left(\frac{x}{\left(x + 1\right) + 4 \cdot \sqrt{x}} - \frac{1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\right)\]
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
6 \cdot \left(\frac{x}{\left(x + 1\right) + 4 \cdot \sqrt{x}} - \frac{1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\right)
double code(double x) {
	return ((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x))));
}
double code(double x) {
	return (6.0 * ((x / ((x + 1.0) + (4.0 * sqrt(x)))) - (1.0 / ((x + 1.0) + (4.0 * sqrt(x))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.0
Herbie0.0
\[\frac{6}{\frac{\left(x + 1\right) + 4 \cdot \sqrt{x}}{x - 1}}\]

Derivation

  1. Initial program 0.2

    \[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity0.2

    \[\leadsto \frac{6 \cdot \left(x - 1\right)}{\color{blue}{1 \cdot \left(\left(x + 1\right) + 4 \cdot \sqrt{x}\right)}}\]
  4. Applied times-frac0.0

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

    \[\leadsto \color{blue}{6} \cdot \frac{x - 1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\]
  6. Using strategy rm
  7. Applied div-sub0.0

    \[\leadsto 6 \cdot \color{blue}{\left(\frac{x}{\left(x + 1\right) + 4 \cdot \sqrt{x}} - \frac{1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\right)}\]
  8. Final simplification0.0

    \[\leadsto 6 \cdot \left(\frac{x}{\left(x + 1\right) + 4 \cdot \sqrt{x}} - \frac{1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\right)\]

Reproduce

herbie shell --seed 2020057 
(FPCore (x)
  :name "Data.Approximate.Numerics:blog from approximate-0.2.2.1"
  :precision binary64

  :herbie-target
  (/ 6 (/ (+ (+ x 1) (* 4 (sqrt x))) (- x 1)))

  (/ (* 6 (- x 1)) (+ (+ x 1) (* 4 (sqrt x)))))