mod operator

# Thread: mod operator

1. Member
Join Date
Dec 1969
Posts
65

## mod operator

Does the mod operator get the integer of the remainder

2. Senior Member
Join Date
Dec 1969
Posts
7,686

## yes and no

I returns an integer, but that is because the two numbers used in the mod opertation is are rounded to the nearest integer before the mod.

3. Member
Join Date
Dec 1969
Posts
65

## RE: yes and no

if so why 19 mod 6.7 is getting 5 which must be 5.6 if you use long division.<BR>And If we assumed that what you have said is right so it should return 1 and not 5??!!

4. Member
Join Date
Dec 1969
Posts
65

## RE: yes and no

I think it&#039;s get the integer after finishing the process not before

5. Senior Member
Join Date
Dec 1969
Posts
7,686

## that what I said

If the two numbers in the mod operation are not integers, they are rounded to the nearest integer, so<BR><BR>19 mod 6.7<BR><BR>will be <BR><BR>19 mod 7 (7 being the nearest integer for 6.7)<BR><BR>and the result will be<BR><BR>2 * 7 = 14<BR><BR>19 - 14 = 5<BR><BR>see?

6. Member
Join Date
Dec 1969
Posts
65

## Now it's clear

.

#### Posting Permissions

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