|
Khana Beginner
Joined: 26 Feb 2009 Posts: 27
|
Posted: Mon May 18, 2009 3:45 am
Simple question! |
I'm attempting to find the average of some variables, I'm going about it like so
#math totalpercfail (((@totalnone+@totalfade+@totalblow)/@totalchant)*100)
The *100 is because I figured it may round up if it's below zero, but even then I'm not getting anything but 0.
Now I'm no algebraic genius, but I think that's the correct format for the equation I want done, and I searched a while to discover / was the symbol for division. Am I using the wrong command or something? |
|
|
|
Rorso Wizard
Joined: 14 Oct 2000 Posts: 1368
|
Posted: Mon May 18, 2009 4:10 am |
Try add %float(@totalchant)
|
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Mon May 18, 2009 4:25 am |
hmm, well I don't see anything wrong with that but Cmud sometimes rounds things funny.
You might try: (((@totalnone+@totalfade+@totalblow)*100)/@totalchant) as your expression |
|
_________________ "To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle |
|
|
|
Khana Beginner
Joined: 26 Feb 2009 Posts: 27
|
Posted: Mon May 18, 2009 4:43 am |
That did the trick, thanks alot.
So when looking for percentages I just have to multiply everything by 100 before hand :P |
|
|
|
Khana Beginner
Joined: 26 Feb 2009 Posts: 27
|
Posted: Mon May 18, 2009 5:21 am |
Now, does anyone know how to force cmud to deal with things in the decimal places?
|
|
|
|
Scirkhan Apprentice
Joined: 14 Sep 2007 Posts: 167 Location: aztx
|
Posted: Mon May 18, 2009 7:39 am |
float?
adding .00 to all your numbers involving a non-whole number should work. |
|
|
|
Khana Beginner
Joined: 26 Feb 2009 Posts: 27
|
Posted: Mon May 18, 2009 5:42 pm |
Changing the order of the equation so that it multiplied before diving worked.
I am dividing by variables, so where in the stage do I add .00? in the triggers that set the variables, or ((@myvar.00+@myvartoo.00)/100)? |
|
|
|
Khana Beginner
Joined: 26 Feb 2009 Posts: 27
|
Posted: Mon May 18, 2009 5:48 pm |
Whoa, so setting all my triggers to define my variables by 1.00 works, but now when the math is done it rounds to about eight places. Anyone know a way to just make it to the hundredths place?
|
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Mon May 18, 2009 5:55 pm |
try formating the number after all your caculating is done see %format
|
|
_________________ "To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle |
|
|
|
Khana Beginner
Joined: 26 Feb 2009 Posts: 27
|
Posted: Mon May 18, 2009 6:25 pm |
That did the trick, appreciate it.
|
|
|
|
|
|