Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

The remainder() function

karambosMay 20 2013 — edited May 20 2013
AFAIK, REMAINDER() works like this:

m - (n * X) where X is the integer nearest m / n

so if we're dealing with REMAINDER(13,5), the result of 13/5 = 2.6 and the nearest integer to 2.6 is 3. I'm assuming you find the nearest integer by using ROUND(). So the result is calculated as 13-(5*3) = 13-15 = -2

So my question is: why is REMAINDER(15,6) = 3?

My thinking is this: 15/6 = 2.5 and the nearest integer to 2.5 is 3. So 15-(6*3) = 15-18 = -3.

so why does sqlplus return +3?

Sorry for such a simple question but I'm a noob studying for the OCA. Any advice appreciated
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 17 2013
Added on May 20 2013
7 comments
233 views