<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">​% can be different with respect to sign in different implementations of C. fmod() in C is designed to work with floats.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">On my system, -10 [mod 3] and -10 [% 3] in Pd work differently. [mod] outputs the positive remainder, which is 2, while % outputs the remainder with the sign of the dividend, which is -1.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">[div] and [mod] form a pair.  Given two numbers A and B, B*(A [div B])+(A [mod B]) = A.  [%] and [/]—[int] should form a similar pair, so -10 [div 3] should yield -4, while int(-10 [/ 3]) should yield -3.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 7, 2016 at 6:44 PM, Miller Puckette <span dir="ltr"><<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I _think_ (but am not sure) that "%" works differently on different<br>
CPU architectures.<br>
<br>
cheers<br>
<span class="HOEnZb"><font color="#888888">Miller<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Sat, May 07, 2016 at 06:27:33PM -0300, Alexandre Torres Porres wrote:<br>
> 2016-05-07 14:53 GMT-03:00 Miller Puckette <<a href="mailto:msp@ucsd.edu">msp@ucsd.edu</a>>:<br>
><br>
> > I put in a sentence to scare users away from "%".  Use "mod" instead :)<br>
> ><br>
><br>
> oh, but I can't see it, so you just did it now, right?<br>
><br>
> I know they differ for negative values input, never knew why the reason..<br>
><br>
> expr also has a "%" function that behaves in the same way as the [%]<br>
> object, to make things more confusing, a "fmod" function in expr also<br>
> behaves in the same was as "%", but for float arguments, and not like<br>
> vanilla's [mod]<br>
><br>
> in max, [%~] (or [modulo~]) will behave the same way as "fmod" in expr,<br>
> that is modulo for float arguments, which is also in agreement to pd<br>
> vanilla's % - only that pd's is for ints.<br>
><br>
> With all that, what I mean to ask and say is that I can't see what's wrong<br>
> with [%] - the odd one out seems to be [mod].<br>
><br>
> what do you say?<br>
><br>
> cheers<br>
<br>
</div></div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
<a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">https://lists.puredata.info/listinfo/pd-list</a><br>
</div></div></blockquote></div><br></div>