So, I'm a tad confused. I was under the impression that this should work: In this case, both a and b are ints (Counters to be exact).
As the result of a / b may possibly contain decimal places, ints obviously won't work. Therefore, I delared a new double and performed the calculation inside it like this:
double texturefactor = ((a / b) * 10);
This doesn't work as I expected, and the result of a / b is always that which I would get if I performed the calculation using an int to store the results. On the other hand, this works:
double calculate1 = a;
double calculate2 = b;
double texturefactor = ((calculate1 / calculate2) * 10);
Couple of perhaps stupid questions- 1. I'm sure this ought to work- I know that in certain situations VS will complain that I've tried to implicitly convert from one type to another- That's what I'm trying to do! Why doesn't it, and have I missed something? :) 2. Should I just convert the counters a and b to doubles and save myself the trouble of the conversion, or is that trouble?
See Question&Answers more detail:os