
-----------------------------------
commandos
Thu May 01, 2008 11:22 pm

Take away decimals.
-----------------------------------
I need to divide two numbers that are always going equal some fraction (smaller number divided by bigger number), then multiply it by 100 and keep it as an integer. Pretty much I need to make a percentage of somthing without any decimals and have it as an integer. Any idea of how I might go about doing this?

-----------------------------------
commandos
Thu May 01, 2008 11:26 pm

RE:Take away decimals.
-----------------------------------
Pfft I feel like an idiot... Literally seconds after I posted this i found the round function which does everything i want it to... Thanks though

-----------------------------------
gitoxa
Fri May 02, 2008 4:25 pm

RE:Take away decimals.
-----------------------------------
Just to point out, there's three functions that do can do this for you.

round 
- returns the closest whole number
round(2.4) = 2
round(4.8) = 5

ceil 
- returns the closest whole number coming after the original number
ceil(2.4) = 3
ceil(4.8) = 5

floor
- returns the closest whole number coming before the original number
floor(2.4) = 2
floor(4.8) = 4


lol mistakes.  Thanks Cavetroll
