Yeah I had a similar problem in trying to determine the hourly rates of resource gathering
Most of us all know it as...
GoodTries
---------- * 100
AllTries
Where we think divide first then multiply by 100 to get a percentage
But EUO only supports interger division so the first part 9/10 is reduced to an integer of 0 = GINT(9/10)
So if you multiply by 100 first then divide, it's mo better
This snippet shows teh bad way and teh good way, plus maybe you want to show tenths? or maybe you want to round?
set !Numerator 9876
set !Denominator 13789
set !Result !Numerator / !Denominator * 100
display ok !Result
set !Result 100 * !Numerator / !Denominator
display ok !Result
;For tenths multiply by an extra power of 10 (from 100 to 1000)
set !Result 1000 * !Numerator / !Denominator
display ok !Result
;add an decimal near the end
str len !Result
str ins !Result #dot #StrRES
set !Result #StrRES
display ok !Result , %
str right !Result 1
if #STRRES >= 5
{
;round up
set !Result 100 * !Numerator / !Denominator + 1
}
else
{
;round down (GINT)
set !Result 100 * !Numerator / !Denominator
}
display ok Which Rounds to: , #spc , !Result
halt