POV-Ray : Newsgroups : povray.advanced-users : Negative division Server Time
29 Jul 2024 08:15:46 EDT (-0400)
  Negative division (Message 21 to 22 of 22)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Will W
Subject: Re: Negative division
Date: 11 Mar 2003 12:04:32
Message: <3e6e1720@news.povray.org>
"Anders K." <and### [at] kaseorgcom> wrote in message
news:3e6dec0b@news.povray.org...
> Will W wrote:
> > POV's method is consistent within its intended framework. The behavior
is
> > that truncation is always to the lower magnitude, which often is what
you
> > want when working in a cartesian coordinate system (where the negation
of
> a
> > value should be a symmetrical with the first value around the origin).
>
> I don't see why anyone would want mod(-x, m) to be symmetrical with mod(x,
> m).


In CSG operations or modifying material maps and so forth, yes, I would
prefer that the arithmetic be symmetrical around the origin. That lets me
get away with a lot of shortcuts since I can then often ignore the direction
of opposing vectors and just work with their magnitudes.


> > Another aspect of the problem that is going unrecognized here is that
> while
> > mathemeticians deal with a true integer number line, there is no way to
> > represent that number line in any computer I know of. The best that can
be
> > done is to set up a large "number circle"-- but there will be some
maximum
> > number which when incremented will yield a negative number, and some
> minimum
> > number which when decremented will yield a positive number.
>
> That's not true with floating-point numbers, which is what we're talking
> about here. Besides, even if they were integers, the result of mod(-1, 3)
is
> much more important than the result of mod(-2147483648, 3).


Uh, no, I was talking about integers, with integer arithmetic like mod( )
and div( ). I don't know any number system that uses a mod( ) or div( ) with
rationals or reals... it sounds sort of interesting. But I don't have the
time or inclination to explore esoteric mathematics (I'm not a
mathematician). And I don't think the POV news groups are the best forum for
such a discussion anyway.

At this point, I fail to see any value in continuing this conversation. We
are no longer using a common terminology, and we are drifting too far from
the purposes of this forum.


--
Will Woodhull
Thornhenge, SW Oregon, USA
willl.at.thornhenge.net

PS-- don't be confused by POV's way of representing all integers as reals.
They aren't, you know. POV's way of doing things is just another of those
shortcuts engineers like to use to make things practical.


Post a reply to this message

From: Anders K 
Subject: Re: Negative division
Date: 11 Mar 2003 14:53:11
Message: <3e6e3ea7$1@news.povray.org>
Will W wrote:
> In CSG operations or modifying material maps and so forth, yes, I would
> prefer that the arithmetic be symmetrical around the origin. That lets me
> get away with a lot of shortcuts since I can then often ignore the
direction
> of opposing vectors and just work with their magnitudes.

Sounds like you're just being lazy, typing mod(x, m) when you should
type -mod(-x, m) -- it's only two extra characters. If that's not what it
is, can you give a more concrete example, like Rune did?

> Uh, no, I was talking about integers, with integer arithmetic like mod( )
> and div( ). I don't know any number system that uses a mod( ) or div( )
with
> rationals or reals...

Actually, mod and div are perfectly well defined on reals: div counts the
greatest integer multiple of b that's at most a, and it is perfectly
possible to consider integer multiples of fractions. You can use exactly the
same formulas:
  div(a, b) = floor(a / b)
  mod(a, b) = a - div(a, b)
Although I just checked in POV-Ray, and it does seem to convert everything
to an integer right now. That's too bad, since mod and div would be useful
with non-integer values (such as angles mod 2*pi), and it also has the
unfortunate side effect that div(10000000000000000000000, 3) = -2147483648.

Anders


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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