Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
You are not logged in.
Post a reply
Topic review (newest first)
Yes I know, Krassi, I was just trying to explain to Ricky what my question WAS.
I gave you a formula!
I think what modulus does with negatives. I mean, with positves you use integer division. 5%2. How many times does 2 fit into five? Twice. So 2 * 2 = 4, subtract 4 from 5 and you get the remainder 1, which is the returned value from this expression. So I can figure out 5%2 without using the computer. How do I figure out 5%-2 or -5%2? That was my question.
Ah, maybe I misunderstood. Mikau, are you looking to find out how the computer implements modulus with negatives or what modulus does with negatives?
So I've helped!
For this you will need a definition of module over the reals.
But this depends. You should see some java help for the java %.
so is anyone going to tell me how? Lol.
I don't agree. If you have some very big messy program, for example, and if it uses many modulus in it, and if it doesn't do what it's supposed to do, then you should know what's happening around the %, because the mistake may be there. If you don't know, you might pass the error, without noticyng it and this can cost you a big headache.
When programming in Java, or really any high level language, it's not so much important to understand how things work. That only starts to make sense when you get down to the assembly level.
yeah me too. Well actually I never studied this particular thing.
dividend / divisor = quotient with a remainder