Average Error: 0.2 → 0.0
Time: 3.6s
Precision: binary64
Cost: 7232
\[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\]
\[6 \cdot \frac{x - 1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\]
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
6 \cdot \frac{x - 1}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
(FPCore (x)
 :precision binary64
 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
(FPCore (x)
 :precision binary64
 (* 6.0 (/ (- x 1.0) (+ (+ x 1.0) (* 4.0 (sqrt x))))))
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 - 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.1
Herbie0.0
\[\frac{6}{\frac{\left(x + 1\right) + 4 \cdot \sqrt{x}}{x - 1}}\]

Alternatives

Alternative 1
Error0.1
Cost7232
\[\frac{6}{\frac{\left(x + 1\right) + 4 \cdot \sqrt{x}}{x - 1}}\]
Alternative 2
Error1.6
Cost7425
\[\begin{array}{l} \mathbf{if}\;x \leq 0.9991673855719797:\\ \;\;\;\;\frac{-6}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{6 \cdot x}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\\ \end{array}\]
Alternative 3
Error2.2
Cost7297
\[\begin{array}{l} \mathbf{if}\;x \leq 0.9991673855719797:\\ \;\;\;\;\frac{-6}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;6\\ \end{array}\]
Alternative 4
Error3.0
Cost385
\[\begin{array}{l} \mathbf{if}\;x \leq 0.9991673855719797:\\ \;\;\;\;-6\\ \mathbf{else}:\\ \;\;\;\;6\\ \end{array}\]
Alternative 5
Error28.7
Cost385
\[\begin{array}{l} \mathbf{if}\;x \leq 0.9991673855719797:\\ \;\;\;\;-6\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 6
Error53.3
Cost385
\[\begin{array}{l} \mathbf{if}\;x \leq 0.9991673855719797:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 7
Error58.0
Cost64
\[1\]

Error

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-identity_binary64_242890.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-frac_binary64_242950.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. Simplified0.0

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

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

Reproduce

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

  :herbie-target
  (/ 6.0 (/ (+ (+ x 1.0) (* 4.0 (sqrt x))) (- x 1.0)))

  (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))