POV-Ray : Newsgroups : povray.bugreports : calculus bug in PovRay3.1 : Re: calculus bug in PovRay3.1 Server Time
26 Jun 2024 05:40:10 EDT (-0400)
  Re: calculus bug in PovRay3.1  
From: Ralf Muschall
Date: 22 Jun 1999 21:04:14
Message: <3770323E.54D8BCA4@t-online.de>
Axel Baune schrieb:

> I think you are wrong. As from my crypography course I know a definition
> for modulus, which also allows negative return values. The modulus function

In math, they usually call this "remainder", defined like
rem(a,b)=a-b*trunc(a/b).

The modulus is defined as Uwe wrote, i.e.
mod(a,b)=a-b*floor(a/b)

Compilers etc. just say
practicalmod(a,b)=a-b*int(a/b)

where int() is required to act like floor() on positive
arguments and left to the implementor for negative ones.
Ususally it behaves like trunc(), since this is what chips
do.

Ralf


Post a reply to this message

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