PDA

View Full Version : Decimal

Ndogg
02-26-2010, 06:57 AM
How could I change a number to a decimal, like 4 to .04 like percents.

Dormilich
02-26-2010, 07:44 AM
I don’t get what you mean by decimal. and what kind of conversion?

SKDevelopment
02-26-2010, 08:43 AM
If you are asking of changing 4 to .04 like percents, you simply divide it by 100 ...

\$p = \$p/100;

If the question is different, could you explain it a little bit more in detail please ?

Ndogg
02-26-2010, 11:08 PM
Lol, ya thats what it is, and im good at math, but whenever it comes to this I want to make sure im doing it right.

\$buildtimediv[\$num] = (1*962)*((2*2)/100); //To get 4% of 962(16:02)
\$buildtime[\$num] = (1*962)-\$buildtimediv[\$num]; //Subtract the 4& from orig.

Would that be correct? and how do I convert the outcome back to a time.

The 1* part is acually an output from a form based on how many you want to build
and
The 4* is based on your level and *2 because the % is x2 your level and thats the part I need help turning into a decimal which the /100 does.