[PD] [expr] - fmod weirdness
oliver
oliver at klingt.org
Tue Jun 23 02:22:37 CEST 2020
Christof Ressi wrote:
> Your "handmade" version is flawed, e.g. with "4.0002" I get 0.00019.
>
> Just round the output of [expr fmod] to as many fractional digits as you
> need, e.g. [* 10000] -> [+ 0.5] -> [int] -> [/ 10000] for 4 digits.
>
> BTW, instead of [expr fmod] you can also do [/] -> [wrap] -> [*].
thanks christof, your help is as always spot-on and foolproof !
yes, that's the method i was looking for.
works 100.00001% ! ;-)
>
> Also note that the behavior of fmod regarding negative numbers is
> implementation specific, e.g. on my system fmod(-0.1, 1) yields -0.1
> (note the negative sign!). On the other hand, [wrap] will *always* yield
> 0.9 (which I think is also what you would expect).
>
right again of course !
thanks once more, that hint took care of another problem i encountered.
best
oliver
More information about the Pd-list
mailing list