Efficiency question:
Dim progress As Integer = ( Current / 100) / ( Maximum / 100 / 100)
would result in.... 3 or 4 division operations? (see question at end of post)
I thought people calculate "percentage" as (current / maximum) * 100
ex. 1/10 = 10%
(1 / 10)* 100
.1 * 100 = 10
1 division operation and 1 multiplication.
Your way:
ex. 1/10 = 10%
(1 / 100) / (10 / 100 / 100)
(.01) / (.001)
== 10
3 or 4 div operations.
So your way works, but seems unnecessarily complex? (/100/100 LOOKS awkward) Is the div instruction faster than mul, where 4 divs would be faster than 1 div and 1 mul ?? Or is there another reason?
compiler person: would /100 / 100 get optimized out to (Maximum / 10000) and cut out a div operation, or no?