modulus and array.length
"Jérôme M. Berger"
jeberger at free.fr
Tue Nov 16 14:10:10 PST 2010
Kagamin wrote:
> Jérôme M. Berger Wrote:
>
>>> -3 mod 3 = 0
>>> -2 mod 3 = -2
>>> -1 mod 3 = -1
>>> 0 mod 3 = 0
>> Note that from a strictly mathematical point of view, this result
>> is valid: for all x and all n, x-(x%n) is a multiple of n.
>
> It's rather (x/n)+(x%n)==x
That is (part of) the definition of the *remainder* operation. The
definition of *modulus* is looser.
Jerome
--
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101116/50047dc6/attachment.pgp>
More information about the Digitalmars-d
mailing list