Average Error: 0.2 → 0.2
Time: 2.5s
Precision: binary64
\[\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \]
\[\log \left({\left(e^{\frac{\mathsf{fma}\left(x, 18, -18\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}\right)}^{0.3333333333333333}\right) \]
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
\log \left({\left(e^{\frac{\mathsf{fma}\left(x, 18, -18\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}\right)}^{0.3333333333333333}\right)
(FPCore (x)
 :precision binary64
 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
(FPCore (x)
 :precision binary64
 (log
  (pow
   (exp (/ (fma x 18.0 -18.0) (fma 4.0 (sqrt x) (+ x 1.0))))
   0.3333333333333333)))
double code(double x) {
	return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
double code(double x) {
	return log(pow(exp(fma(x, 18.0, -18.0) / fma(4.0, sqrt(x), (x + 1.0))), 0.3333333333333333));
}

Error

Bits error versus x

Target

Original0.2
Target0.1
Herbie0.2
\[\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. Simplified0.2

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(6, x, -6\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}} \]
  3. Applied add-log-exp_binary640.2

    \[\leadsto \color{blue}{\log \left(e^{\frac{\mathsf{fma}\left(6, x, -6\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}\right)} \]
  4. Applied add-cbrt-cube_binary640.2

    \[\leadsto \log \color{blue}{\left(\sqrt[3]{\left(e^{\frac{\mathsf{fma}\left(6, x, -6\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}} \cdot e^{\frac{\mathsf{fma}\left(6, x, -6\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}\right) \cdot e^{\frac{\mathsf{fma}\left(6, x, -6\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}}\right)} \]
  5. Simplified0.2

    \[\leadsto \log \left(\sqrt[3]{\color{blue}{e^{\frac{\mathsf{fma}\left(x, 18, -18\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}}}\right) \]
  6. Applied pow1/3_binary640.2

    \[\leadsto \log \color{blue}{\left({\left(e^{\frac{\mathsf{fma}\left(x, 18, -18\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}\right)}^{0.3333333333333333}\right)} \]
  7. Final simplification0.2

    \[\leadsto \log \left({\left(e^{\frac{\mathsf{fma}\left(x, 18, -18\right)}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}\right)}^{0.3333333333333333}\right) \]

Reproduce

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