Results 1 to 5 of 5

Thread: modulus confusion. basic question!

  1. #1

    Thread Starter
    Hyperactive Member voidflux's Avatar
    Join Date
    Jun 2003
    Location
    Brockway, PA
    Posts
    290

    Question modulus confusion. basic question!

    hello everyone!
    I just discovered i've been treating % the wrong way, i always thought it was the number right after the decimal point. But i soon found out its the remainder on the fraction, such as this:
    34%5
    34/5 = (30 + 4)/5 = (30/5) + (4/5) = 6 + 4/5 = 4
    right?
    so how is
    -34%-5 == -4?
    I don't understand why it comes out to -4, can someone write it out like i did above and show me?
    also how is 4%6 = 4?
    thanks!
    C¤ry Sanchez
    Computer Science/Engineering
    @ Penn State
    IBM.zSeries Intern
    Mandriva 2007

  2. #2
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    -34%-5=-4

    I believe that is because when a negative number divided by a negative number, it's remainder is a negative number unless you are talking about the result which is positive.

    4%6 = 4

    This is correct. The division result is zero and the remainder is 4.

  3. #3

    Thread Starter
    Hyperactive Member voidflux's Avatar
    Join Date
    Jun 2003
    Location
    Brockway, PA
    Posts
    290

    Question

    Thanks for the reply but I still don't understand why it equals -4 or why 4%6 = 4?
    Can you write it out like u were going to solve it on a piece of paper? Like I did above with 35%5;
    Thanks
    C¤ry Sanchez
    Computer Science/Engineering
    @ Penn State
    IBM.zSeries Intern
    Mandriva 2007

  4. #4
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    4%6=4 because 6 goes into 4 0 times with a remainder of 4...

  5. #5

    Thread Starter
    Hyperactive Member voidflux's Avatar
    Join Date
    Jun 2003
    Location
    Brockway, PA
    Posts
    290

    Thumbs up

    OHhh! I get it now! I don't nkow what the hell i was doing above, thanks!!
    C¤ry Sanchez
    Computer Science/Engineering
    @ Penn State
    IBM.zSeries Intern
    Mandriva 2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width