Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Modulus Inconsistencies (Or Calling all Mathematicians)

by bronto (Priest)
on Mar 26, 2003 at 17:57 UTC ( [id://246016]=note: print w/replies, xml ) Need Help??


in reply to Modulus Inconsistencies (Or Calling all Mathematicians)

The reminder of a division is, by definition, a positive number. So the answer "-3" is plain wrong.

Ciao!
--bronto

Update: To be exact: if n and m are an integer numbers (i.e. 0, -1, 1, -2, 2...) there is a unique decomposition of the form:

n = mq + r

with r and q integers and |n| > r >= 0. q is said to be the quotient and r the reminder

That's why a negative reminder is wrong by definition

Update: fixed a typo.


The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://246016]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found