\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
6 \cdot \log \left(e^{\frac{-1 + x}{\mathsf{fma}\left(4, \sqrt{x}, x + 1\right)}}\right)
(FPCore (x) :precision binary64 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
(FPCore (x) :precision binary64 (* 6.0 (log (exp (/ (+ -1.0 x) (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 6.0 * log(exp((-1.0 + x) / fma(4.0, sqrt(x), (x + 1.0))));
}




Bits error versus x
| Original | 0.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
Initial program 0.2
Applied *-un-lft-identity_binary640.2
Applied times-frac_binary640.0
Simplified0.0
Simplified0.0
Applied add-log-exp_binary640.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2021275
(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)))))