Used floor instead of static_cast
Implemented JOhn's suggestion of dividing beginninf from x+1 instead of from x+k-1. Results much better for lower precision now. Pretty much the same results for higher precision. Gamma for negative numbers still faulty as before. Need to look into that.