\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467 - x\right) + \left(\left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right) + \frac{0.083333333333333}{x}\right)
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))(FPCore (x y z) :precision binary64 (+ (fma (- x 0.5) (log x) (- 0.91893853320467 x)) (+ (* (* z (/ z x)) (+ 0.0007936500793651 y)) (/ 0.083333333333333 x))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
double code(double x, double y, double z) {
return fma((x - 0.5), log(x), (0.91893853320467 - x)) + (((z * (z / x)) * (0.0007936500793651 + y)) + (0.083333333333333 / x));
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 6.1 |
|---|---|
| Target | 1.2 |
| Herbie | 0.7 |
Initial program 6.1
Simplified6.1
Applied fma-udef_binary646.1
Applied associate--l+_binary646.1
Applied fma-def_binary646.1
Applied clear-num_binary646.2
Applied associate-/r/_binary646.2
Applied fma-udef_binary646.2
Applied distribute-rgt-in_binary646.2
Simplified1.2
Simplified1.1
Taylor expanded in z around inf 6.6
Simplified0.7
Final simplification0.7
herbie shell --seed 2021215
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))