The result of testvar2 below keeps returning as 1.000, when it should be 1.040, anybody any ideas why? i have tried it with allowing more decimal points when printing. I have
instead of doing a single line calculation i even broke it into seperate statements to make sure no precedence issues.
and the last statement shows me the correct answer so something is going on with storage.
I also compiled the code below which names the variables a bit differently after restarting the ide in a new file to get rid of any evil spirits and /or Hexes on the program and same result
double testvar1 = 0;
double testvar2 = 0;
double Xacr = 1;
double Hres = 80;
testvar1 = Xacr / Hres;
testvar2 = testvar1 * Hres;
printf("%.3f, %.3f\n",testvar1, testvar2);
printf("%.3f\n", 0.013 * 80);