POV-Ray : Newsgroups : povray.general : INQUIRY: How to Get After-Period Value Server Time
19 Apr 2024 19:57:25 EDT (-0400)
  INQUIRY: How to Get After-Period Value (Message 11 to 11 of 11)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Tor Olav Kristensen
Subject: Re: INQUIRY: How to Get After-Period Value
Date: 3 Apr 2018 09:00:01
Message: <web.5ac379a436b915785bf3e3600@news.povray.org>
"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

<<< Previous 10 Messages Goto Initial 10 Messages

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