POV-Ray : Newsgroups : povray.binaries.images : Strange behaviour of mod() : Re: Strange behaviour of mod() Server Time
27 Sep 2024 01:17:45 EDT (-0400)
  Re: Strange behaviour of mod()  
From: Jörg "Yadgar" Bleimann
Date: 21 Sep 2024 09:42:34
Message: <66eecd4a$1@news.povray.org>
Hi(gh)!

On 21.09.24 08:33, MichaelJF wrote:

> mod() seems to affect only the integer part of a float value. E.g., 
> mod(24.88248825,25)=24.88248825 and mod(25.00250053,25)=0.00250053.
> 
> The value of 100 comes from the rounding by str(value,-2,0). E.g.,
> str(24.88248825*4,2,0)=str(99.52995300,-2,0)=100, as the fractional part 
> is greater than 0.5.
> 
> Maybe
> 
> #declare centiseconds=floor(mod(clock,25)*4);
> 
> will serve you better.

When I tried this, I got centiseconds from 03 to 99... also not 
satisfactory (pun intended!), as I wanted 04 to 00 (or 00 to 96). Then I 
looked up my command line... and noticed that +kf and +kff were not 
identical (+kf154115 but, accidentally, +kff145155)! So there was a tiny 
but growing fractional remainder at each frame number divisible by 25! I 
corrected this, and now it works perfect even without floor()! 
Nevertheless, thank you for your suggestion!

See you in Khyberspace!

Yadgar


Post a reply to this message

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