|
mrkelley Beginner
Joined: 15 Aug 2006 Posts: 14
|
Posted: Fri Sep 29, 2006 9:33 pm
Making a variable do math from other variables |
Title kinda says it all, could really use help here.
I'm trying to make Var1 = the divided sum of Var2 and Var 3.
The following code isn't working.
Code: |
#VAR Var1 %eval( @Var2/@Var3)
#VAR Var1 (%eval( @Var2/@Var3))
#MATH Var1 (@Var2/@Var3) |
Also, this will result in a decimal type number less than 1 (which may be my problem). Therefor I'd like to show 0.00 (in truth i'm just looking for a percentage)
Any help, please? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Sep 29, 2006 10:06 pm |
Math is generally done as integer math. The use of floating point values is often less precise then properly handled integer methods. You should multiply first then divide. Finally %insert the decimal point in the correct place just when displaying.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
mrkelley Beginner
Joined: 15 Aug 2006 Posts: 14
|
Posted: Fri Sep 29, 2006 10:09 pm |
That makes very little sense to me. an example please?
|
|
|
|
mrkelley Beginner
Joined: 15 Aug 2006 Posts: 14
|
Posted: Fri Sep 29, 2006 10:17 pm |
Actually disregard. it works perfectly now. thank you.
|
|
|
|
|
|