Thread: Get Progress

Results 1 to 3 of 3
  1. #1
    pDevice's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    d3d9.h
    Posts
    1,306
    Reputation
    15
    Thanks
    420
    My Mood
    Stressed

    Get Progress

    My English is translated, Sorry

    This function returns a percentage from 0% to 100% according to the value.

    Example:
    Code:
    Dim progress As Integer = ( Current / 100) / ( Maximum / 100 / 100)
    Example 2 ( Using ProgressBar ):
    Code:
    Dim progress As Integer = ( Progressbar1.Value / 100 ) / ( Progressbar1.Maximum / 100 / 100 )
    I used it in a scan file, the maximum is the total of the files and the current is being scanned !
    The progress variable will return a percentage value to 100%
    She can be utilized to generate large percentage of values.

    Credits
    Code:
    pDevice (done unintentionally but left what I wanted)



  2. #2
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    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?
    Last edited by abuckau907; 11-23-2013 at 08:36 PM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  3. The Following User Says Thank You to abuckau907 For This Useful Post:

    pDevice (11-25-2013)

  4. #3
    pDevice's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    d3d9.h
    Posts
    1,306
    Reputation
    15
    Thanks
    420
    My Mood
    Stressed
    Quote Originally Posted by abuckau907 View Post
    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?
    was a difficult but worked through and yes you are right can be optimized.



Similar Threads

  1. Get Avatars and Sigs!
    By Dave84311 in forum General
    Replies: 25
    Last Post: 05-17-2006, 08:44 PM
  2. Plz I Want Maple Global Hacks And Where Do I Get Game Engine 2 Make The Hacks Work???
    By mattinthehat in forum MapleStory Hacks, Cheats & Trainers
    Replies: 3
    Last Post: 01-15-2006, 06:12 PM
  3. Free Infantry Gets Owned By MPGH
    By Super-Man in forum General Game Hacking
    Replies: 34
    Last Post: 01-03-2006, 05:29 PM
  4. How to get Perl
    By shercipher in forum Programming
    Replies: 2
    Last Post: 01-02-2006, 11:28 PM