|Syntactic Confectionery Delight|
Re: 0 illegal modulus?by Zaxo (Archbishop)
|on Jun 16, 2001 at 12:31 UTC||Need Help??|
Everybody, please pay attention to jepri. He's got it right.
The definition of Abel he mentions is that (perlishly):my $num = $y*int($n) + $modulus;
This relation is uniquely satisfied by !$y && $modulus == $num
It does not involve division, allowing it to apply to algebrae lacking a multiplicative inverse (those are called modules).
It applies to floats too. Think $y = 2*$pi. Modulus is phase in that case.
Perl's % operator is really just remainder on integers, a bogosity which does not generalize well.
Don't fall into the trap of thinking your intuition or experience is a valid basis for modifying mathematical definitions. You will come to grief when a "proven correct" program crashes. You may blame math, but you will be wrong.