Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualKhatharr

Posted 29 April 2013 - 08:50 PM

Careful now...

 

 

    if(input>6) //this condition is (usually) not an effective optimization and is mathematically irrelevant
        input = input % 7;
    if(input<0)
        input = (input % 7) + 7; //this is incorrect in cases where input == n * -7

 

Try:

 

 

    input %= 7;
    if(input<0)
        input +=  7;

#3Khatharr

Posted 29 April 2013 - 08:48 PM

Careful now...

 

 

    if(input>6) //this condition is (usually) not an effective optimization and is mathematically irrelevant
        input = input % 7;
    if(input<0)
        input = (input % 7) + 7; //this is incorrect in cases where input == n * -7

 

Try:

 

 

    input = input % 7;
    if(input<0)
        input +=  7;

#2Khatharr

Posted 29 April 2013 - 08:40 PM

Careful now...

 

 

    if(input>6) //this condition is not an effective optimization and is mathematically irrelevant
        input = input % 7;
    if(input<0)
        input = (input % 7) + 7; //this is incorrect in cases where input == n * -7

 

Try:

 

 

    input = input % 7;
    if(input<0)
        input +=  7;

#1Khatharr

Posted 29 April 2013 - 08:39 PM

Careful now...

 

    if(input>6) //this condition is not an effective optimization and is mathematically irrelevant
        input = input % 7;
    if(input<0)
        input = (input % 7) + 7; //this is incorrect in cases where input == n * -7

 

Try:

 

   input = input % 7;
    if(input<0)
        input +=  7;

PARTNERS