Did you read garions post? You are trying to return a double when it the return type is set to void change it to a double. Then I mentioned earlier you are doing integer division so you are more than likely to get 0 when dividing by 8000+ too lazy to do the math by hand but just a . or .0 or .f or .0f at the end or cast them to double/float