POV-Ray : Newsgroups : povray.newusers : What does the 'mod' operator do? : Re: What does the 'mod' operator do? Server Time
10 Nov 2025 20:45:45 EST (-0500)
  Re: What does the 'mod' operator do?  
From: jr
Date: 10 Nov 2025 02:40:00
Message: <web.691196451bdd4431475fba6a6cde94f1@news.povray.org>
hi,

"Kenneth" <kdw### [at] gmailcom> wrote:
> I am new to POV-ray's 'mod' operator-- and the meaning of 'modulo' itself. I
> have seen it used in many newsgroup code examples-- and there are probably
> numerous newsgroup posts asking questions about it through the years-- but I
> never really understood what it does or what to expect as the result, due to the
> rather terse explanation in the docs:
>
> mod(A,B)
> Value of A modulo B. Returns the remainder after the integer division of A/B.
> Formula is mod=((A/B)-int(A/B))*B.
>
> It has never been quite clear to me what 'integer division' means there ...
> ...
> QUESTION: "What does 'modulo' really mean?"
> ANSWER: "It depends on who you ask..."
>    :-o

fwiw, I like the term "clock arithmetic", can understand it :-), find it
"illustrative".
<en.wikipedia.org/wiki/Modular_arithmetic>


regards, jr.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.