I was getting strage results of my math, when i isolated the problem:
How can double result of 20/40 can be 0.0 ? What am I doing wrong?
i managed to find workaround. This is absurd though!
If those were the times when we were still using 16mhz processors that useless equation would take a lot of cpu power. (dividing by 10 is time consuming, 10 != 2^n or sum of those divisions for different n)
20/40 is calculated as integer values. So the result of 0 is an integer assigned to a double value.
20.0/40 is calculated as double values. So the result of 0.5 is an double assigned to a double value.
I made a little experiment and found that it is related to data type. You have to put decimal sign it est 20./40. or you may use
double a = 20,
b = 40;
co_multi = a/b;
Alert ("co_multi = ", co_multi);
//then the result is correct.