27

This does not make any sense!

Comments
  • 5
    Approximation, did wrong.
  • 2
    @JS96 it should say 99%
  • 3
    @HampusMa true, it’s 99.4%, so it’s not a correct approximation 🤔
  • 0
    I thought rounding up for progress percentages was pretty common?
  • 2
    @JS96
    This is how they should have done it

    <code>

    Int numbers;
    Int percent;

    while(percent < 101)
    {
    If(percent == 15) \\ to example
    {
    \\ do the stuff you want
    }

    If(percent == 70) \\ to example
    {
    \\ do the stuff you want
    }

    // Add to percentage and numbers
    percent = percent + 1;
    numbers = numbers + 1;

    // Change the text on the app
    percentage.text = percent;
    stuffdone.text = numbers + " /
    510";
    }

    </code>
  • 1
    The code tags didnt work though
  • 3
    @HampusMa it's probably something more similar to this:

    for (int i = 0; i < IPs->count; i++) {
    // Scan IP
    String IP = IPs[i];
    // Do stuff

    percent = round((i+1) / IPs->count) * 100);

    percentage.text = percent;
    stuffdone.text = (i+1) + " / " IPS->count;
    }

    But probably someone used "ceil()" instead of "round()", which returns the bigger integer ignoring the decimals (99.4 -> 100, 99.8 -> 100).
  • 1
    @JS96 yeah thats problably what the should have done
  • 0
    I would say net-, broadcast- and your own address are maybe not worth to be counted ...
    Net and broadcast should not be in use.
    As you are doing things, you are online...

    So, seems ok for me.
  • 2
    Incorrect even rounded :v
  • 1
    <@HampusMa>
    "percent < 101"?
    Are you serious?
    What about "percent <= 100"? Looks much cleaner.
  • 0
    @Skayo But then it would stop at 99%
  • 1
    Oh dear
  • 1
    <@HampusMa>
    No?
    Do you know what "smaller than or equal to" means?
  • 0
    And what's with 100 to the power of %? Oh right... Designers were in majority.
  • 0
    @Skayo yeah.

    I did while percent is less than 101.

    That means, when it goes to 100 it stops because if it goes to 101 it is equal to 101 not less than
  • 1
    @HampusMa I think you still have some learning to do lol.

    His code is the same as

    If percent is less than 100

    AND (notice the and)

    If percent equals 100.
  • 0
    @neodite his code? I though we where talking about mine.
  • 1
    @HampusMa no, we are talking about when @Skayo said you should be using

    <= 100

    Instead of your < 101

    And you seem to not understand his does the same thing.
  • 0
    @neodite i didn't know we where talking about his. If i knew that then l would understand.
Add Comment