POV-Ray : Newsgroups : povray.bugreports : calculus bug in PovRay3.1 : calculus bug in PovRay3.1 Server Time
14 Jun 2024 15:21:50 EDT (-0400)
  calculus bug in PovRay3.1  
From: Uwe Zimmermann
Date: 22 Jun 1999 04:23:19
Message: <376F47F5.89E8568D@ele.kth.se>
Hello List,

yesterday I installed the 3.1e version of PovRay on my Windows NT4 sp3
computer and discovered a bug in the mathematics part of PovRay:

the mod(A,B) function is meant to provide the modulus of A divided by B.
Per definition the modulus is a NON-NEGATIVE INTEGER value. However if
you ask PovRay to perform modulus calculations with A being negative you
get a negative result:

                PovRay        definition

mod(0,5)          0                0        OK
mod(1,5)          1                1        OK
mod(2,5)          2                2        OK
mod(3,5)          3                3        OK
mod(4,5)          4                4        OK
mod(5,5)          0                0        OK
mod(6,5)          1                1        OK
mod(7,5)          2                2        OK

BUT

mod(0,5)          0                0        OK
mod(-1,5)        -1                4        WRONG
mod(-2,5)        -2                3        WRONG
mod(-3,5)        -3                2        WRONG
mod(-4,5)        -4                1        WRONG
mod(-5,5)         0                0        WRONG
mod(-6,5)        -1                4        WRONG
mod(-7,5)        -2                3        WRONG

as I noticed this bug was already present in v3.0 of PovRay for win32
and thus I'm wondering if it's a bug or a feature. At least it should be
noted in the documentation that PovRay does not use the standard
definition of the modulus calculation.


Uwe.

-------------------------------------------------
Uwe Zimmermann                uwe### [at] geocitiescom	
Dipl. Phys.                     uwe### [at] elekthse 

           Department of Electronics
            Solid State Electronics
         Royal Institute of Technology
                 Electrum 229
           S-16440 Kista-Stockholm
                   Sweden

http://www.ele.kth.se/FTE/personal/pers_uwe.html
------------------------------------------------


Post a reply to this message

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