|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
> Another interesting way to do it would be to use POV-Ray's built-in 'floor'
> function:
>
> #declare AAA = 7.23;
>
> #declare REMAINDER = AAA - floor(AAA);
> ...
Beware that you get different results for positive and negative numbers when you
use floor or ceil.
Try this:
#for (A, -1.5, +1.5, 3)
#debug concat("A = ", str(A, 0, -1), "\n")
#debug concat("A - int(A) = ", str(A - int(A), 0, -1), "\n")
#debug concat("A - floor(A) = ", str(A - floor(A), 0, -1), "\n")
#debug concat("A - ceil(A) = ", str(A - ceil(A), 0, -1), "\n")
#debug concat("mod(A, 1) = ", str(mod(A, 1), 0, -1), "\n")
#debug "\n"
#end // for
--
Tor Olav
http://subcube.com
Post a reply to this message
|
|