





 
 




 
 


Hi,
I have values like 7.23 or 19.59
and want to retrieve just the value after the period sign (23).
I am sure, POVRay has a function for that, but none of their names
rings my bells.

Diese EMail wurde von AVG auf Viren geprÃ¼ft.
http://www.avg.com
Post a reply to this message


 
 




 
 


On 01/04/2018 06:16, Sven Littkowski wrote:
> Hi,
>
> I have values like 7.23 or 19.59
>
> and want to retrieve just the value after the period sign (23).
> I am sure, POVRay has a function for that, but none of their names
> rings my bells.
>
int() will return the numbers to the left of the decimal point. So
subtract one from the other. And with any luck. There she is.

Regards
Stephen
Post a reply to this message


 
 




 
 


Le 180401 Ã 01:16, Sven Littkowski a Ã©critÂ :
> Hi,
>
> I have values like 7.23 or 19.59
>
> and want to retrieve just the value after the period sign (23).
> I am sure, POVRay has a function for that, but none of their names
> rings my bells.
>
> 
> Diese EMail wurde von AVG auf Viren geprÃ¼ft.
> http://www.avg.com
>
Try something like this :
#declare Fractional = In_Value  int(In_Value);
Post a reply to this message


 
 




 
 


Another interesting way to do it would be to use POVRay's builtin 'floor'
function:
#declare AAA = 7.23;
#declare REMAINDER = AAA  floor(AAA);
 I'm kind of surprised that POVRay doesn't have a 'remainder' function
builtin. I looked in all of the documentation sections that I could think of,
but no luck. It would be a useful addition for the future ;)
Post a reply to this message


 
 




 
 


"Kenneth" <kdw### [at] gmailcom> wrote:
mod(A,B) Value of A modulo B. Returns the remainder after the integer division
of A/B. Formula is mod=((A/B)int(A/B))*B.
So, I'm guessing mod(A, 1) gives you the remainder.
((1.25/1)  1) = 0.25, times 1 = 0.25
Post a reply to this message


 
 




 
 


"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
>
>
> mod(A,B) Value of A modulo B. Returns the remainder after the integer division
> of A/B. Formula is mod=((A/B)int(A/B))*B.
>
> So, I'm guessing mod(A, 1) gives you the remainder.
>
> ((1.25/1)  1) = 0.25, times 1 = 0.25
Yeah, mode(A,B) was as close as I could find to such a function... but I didn't
work it out. It looked... complicated :P
Nice.
Post a reply to this message


 
 




 
 


"Kenneth" <kdw### [at] gmailcom> wrote:
> Yeah, mode(A,B) was as close as I could find to such a function... but I didn't
> work it out. It looked... complicated :P
I poked the bear once, and I learned. ;)
http://news.povray.org/povray.newusers/thread/%3Cweb.51fb3b6e744b4afe73fc9ebb0%40news.povray.org%3E/
So now I remember as well as I can what mod(A, B) does. :D
Post a reply to this message


 
 




 
 


"Kenneth" <kdw### [at] gmailcom> wrote:
>
> Yeah, mode(A,B) was as close as I could find...
mode(A/B) ??? Er, I meant mod(A/B) . It's my keyboard's fault!!!! Uh,
naturally.
Post a reply to this message


 
 




 
 


Thanks, Stephen Alain and Kenneth.
And yes, a REMAINDER function would be useful as that would be the
direct road to get the value after the period sign (fractionals).

Diese EMail wurde von AVG auf Viren geprÃ¼ft.
http://www.avg.com
Post a reply to this message


 
 


From: Sven Littkowski
Subject: Re: INQUIRY: How to Get AfterPeriod Value
Date: 3 Apr 2018 09:57:59
Message: <5ac35027@news.povray.org>



 
 


I will use the formula of
"MyFractional = MyInitialValue  int(MyInitialValue)"
to convert time value fractionals (00..59) into decimal fractionals.
This will allow me to let the sun (light_source) wander over the sky
depending on the time value the user enters as value of MyTime. :)

Diese EMail wurde von AVG auf Viren geprÃ¼ft.
http://www.avg.com
Post a reply to this message


 
 




 