Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Find if a number is a multiple of a number.

by blazar (Canon)
on Mar 03, 2005 at 08:59 UTC ( [id://436208]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^3: Find if a number is a multiple of a number.
in thread Find if a number is a multiple of a number.

Binary "%" computes the modulus of two numbers.Given integer operands $a and $b: If $b is positive, then "$a % $b" is $a minus the largest multiple of $b that is not greater than $a. If $b is negative then "$a % $b" is $a minus the smallest multiple of $b that is not less than
And... so what?
$a (i.e. the result will be less than or equal to zero). Note that when "use integer" is in scope "%" gives you direct access to the mod- ulus operator as implemented by your C compiler. This operator is not as well defined for negative operands, but it will execute faster.
Is this the particular point on which you meant to draw the attention? If so, then it actually is a good point, however IMHO it belongs more to the realm of side notes...
  • Comment on Re^4: Find if a number is a multiple of a number.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://436208]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.