Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Mod

Reply
 
 
RN1
Guest
Posts: n/a
 
      12-14-2007
79 Mod 92 evaluates to 79

156 Mod 249 evaluates to 156

So while using the Mod operator, if the first number is less than the
second number, will the result be ALWAYS EQUAL to the first number?
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      12-14-2007
RN1 wrote:
> 79 Mod 92 evaluates to 79
>
> 156 Mod 249 evaluates to 156
>
> So while using the Mod operator, if the first number is less than the
> second number, will the result be ALWAYS EQUAL to the first number?


Yes. Think back to second or third grade when learning about division.
If you divide 79 by 92, you got a remainder, right? 92 gazinto 79 zero
times with a remainder of 79.
That's the modulus, or mod for short.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      12-14-2007

"RN1" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 79 Mod 92 evaluates to 79
>
> 156 Mod 249 evaluates to 156
>
> So while using the Mod operator, if the first number is less than the
> second number, will the result be ALWAYS EQUAL to the first number?


Not exactly -390 is less than 79 but -390 mod 79 is 74.

You might consider reading the documentation:-

http://msdn2.microsoft.com/en-us/library/basszbdt.aspx


Modulus is a standard mathematical operation:-


http://mathworld.wolfram.com/Modulus.html



--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      12-14-2007
"Anthony Jones" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "RN1" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 79 Mod 92 evaluates to 79
> >
> > 156 Mod 249 evaluates to 156
> >
> > So while using the Mod operator, if the first number is less than the
> > second number, will the result be ALWAYS EQUAL to the first number?

>
> Not exactly -390 is less than 79 but -390 mod 79 is 74.
>


Typo: -74

> You might consider reading the documentation:-
>
> http://msdn2.microsoft.com/en-us/library/basszbdt.aspx
>
>
> Modulus is a standard mathematical operation:-
>
>
> http://mathworld.wolfram.com/Modulus.html
>
>
>




--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
RN1
Guest
Posts: n/a
 
      12-14-2007
On Dec 15, 12:33 am, "Anthony Jones" <(E-Mail Removed)> wrote:
> "RN1" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
> > 79 Mod 92 evaluates to 79

>
> > 156 Mod 249 evaluates to 156

>
> > So while using the Mod operator, if the first number is less than the
> > second number, will the result be ALWAYS EQUAL to the first number?

>
> Not exactly -390 is less than 79 but -390 mod 79 is 74.
>
> You might consider reading the documentation:-
>
> http://msdn2.microsoft.com/en-us/library/basszbdt.aspx
>
> Modulus is a standard mathematical operation:-
>
> http://mathworld.wolfram.com/Modulus.html
>
> --
> Anthony Jones - MVP ASP/ASP.NET


-19 Mod 7 evaluates to -5....that's fine but

-19 Mod -7 also evaluates to -5. Why? Shouldn't it evaluate to 5?

Also how does 19 Mod -7 evaluate to 5 (& not -5)?
 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      12-14-2007
RN1 wrote:
> On Dec 15, 12:33 am, "Anthony Jones" <(E-Mail Removed)> wrote:
>> "RN1" <(E-Mail Removed)> wrote in message
>>
>>

news:(E-Mail Removed)...
>>
>>> 79 Mod 92 evaluates to 79

>>
>>> 156 Mod 249 evaluates to 156

>>
>>> So while using the Mod operator, if the first number is less than
>>> the second number, will the result be ALWAYS EQUAL to the first
>>> number?

>>
>> Not exactly -390 is less than 79 but -390 mod 79 is 74.
>>
>> You might consider reading the documentation:-
>>
>> http://msdn2.microsoft.com/en-us/library/basszbdt.aspx
>>
>> Modulus is a standard mathematical operation:-
>>
>> http://mathworld.wolfram.com/Modulus.html
>>

>
> -19 Mod 7 evaluates to -5....that's fine but
>
> -19 Mod -7 also evaluates to -5. Why? Shouldn't it evaluate to 5?


-7 * 2 = -14

What do you have to add to -14 to get -19?

>
> Also how does 19 Mod -7 evaluate to 5 (& not -5)?


Again, -7 * -2 = 14. What do you have to add to 14 to get 19?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why doesn't `from pkg import mod' work after `del pkg.mod'? ryles Python 3 07-26-2009 04:13 PM
difference between import from mod.func() and x=mod.func() Hari Sekhon Python 0 06-20-2006 08:07 AM
How to: How NOT to Mod a Case! Silverstrand Reviews & How-To's 15 07-17-2005 02:26 AM
How to: Mod a PSU (Power Supply) Silverstrand Reviews & How-To's 17 07-06-2005 06:41 AM
append_features(mod) -- mod.kind_of? makes absolutely no sense T. Onoma Ruby 9 12-15-2003 03:34 AM



Advertisments