\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
\frac{\mathsf{fma}\left(6, x, -6\right)}{\mathsf{fma}\left(4, \sqrt{x}, x\right) + 1}
(FPCore (x) :precision binary64 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
(FPCore (x) :precision binary64 (/ (fma 6.0 x -6.0) (+ (fma 4.0 (sqrt x) x) 1.0)))
double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
double code(double x) {
return fma(6.0, x, -6.0) / (fma(4.0, sqrt(x), x) + 1.0);
}




Bits error versus x
| Original | 0.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
Initial program 0.2
Simplified0.2
Applied egg-rr0.2
Final simplification0.2
herbie shell --seed 2022130
(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)))))