have you tried to debug?
try to simplify formula till you can reproduce the calculations by hand,
replace g=9,8 with g=10
coef_k with 1
remove converting Mass and enter it in Kg
Get to the simplest formula possible. And debug your application step-by-step checking each result on paper.
When you get this stripped formula working - start adding back parts you have removed, adding it one-by-one, checking that your new formula is still working