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:46 EST (-0500)
  Re: What does the 'mod' operator do?  
From: Bald Eagle
Date: 10 Nov 2025 10:00:00
Message: <web.6911fcfe1bdd4431c93adb4f25979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> Unfortunately, I'm still a bit puzzled by the docs' written description.

Well don't feel bad - because at one time I was too.
https://news.povray.org/povray.newusers/thread/%3Cweb.51fb3b6e744b4afe73fc9ebb0%40news.povray.org%3E/?mtop=386122

> But
> another interpretation in the 'modulo' topic...if I understand it
> correctly...puts no restriction on the values re: floats vs. integers--
> "depending on the programming language used."

Yes, well, when you get around to playing with / using these things enough, you
find that things like this can be ... flexible.
What is N/0?  It it "undefined"?  "unbounded"?  Infinity?
what about pow(0, 0)?

Sometimes the definitions of things change - or, rather - grow - to encompass
new discoveries and new ways of understanding, and therefore defining what that
thing is.

Like acids.  There have been a number of progressive expansions of the
definition of what an acid is.  All the way from Bronstead to Lewis.

zero
Negative numbers
or the square root of -1.
Look at the fundamentals of calculus.  We needed LIMITS to make that leap, and
land on putatively solid ground.

So:
Can you take the modulo of a COMPLEX number?
.. . .might depend on which computer language you use.


> In any case, POV-ray's 'mod' can obviously work with float values too...and
> fractions...at least when running in Windows.

Well of course.  If I have a 40-foot, 9-inch long log, and I want to cut it up
into sections that are 18 inches long, or 1.5 feet, then I will get a certain
integer number of logs, plus some remainder.
Just conceptually replace "integer" with "unit value".

(The universe is silently begging you to then expand your inquiries and
understanding to Basis Vectors ;) )

> So IMO the docs are either
> outdated or too 'strict', and at least somewhat unclear.

The docs in that case are just "poorly written" - because probably at the time,
they just wanted to casually provide the kindergarten-level explanation of the
function, and get on with the rest of it, rather than expanding it into a
mathematically accurate treatise on Modular Arithmetic.

Likely the documentation needs to be written in a large number of places, if
only to clear up little details like this.

I voluntell Kenneth.   :D

- BE


Post a reply to this message

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