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?? |
The reminder of a division is, by definition, a positive number. So the answer "-3" is plain wrong. Ciao! 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 + rwith 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).
In Section
Seekers of Perl Wisdom
|
|