[MPlayer-dev-eng] [PATCH] cropdetect
Torinthiel
torinthiel at megapolis.pl
Tue Aug 10 08:48:32 CEST 2004
On Mon, Aug 09, 2004 at 11:12:39PM -0400, Adrian wrote:
>
> > > Also, this is not true:
> > > > (a - b) % c = (a % c) - (b % c)
> >
> > this is, though, correct?
> >
> > (a - b) % c = ((a % c) - (b % c)) % c
>
> Nope.
>
> a = 2
> b = 4
> c = 3
Now, that's something contrary to 'normal' mathematical modulus
operator. In mathematics output of -1 mod 3 is 2. So the example would
be correct. In C however % operator does not change sign, and
-1%3=-4%3=-1.
So a % b is like mathematical sgn(a)*(abs(a) mod b)
sgn of course returns -1 if a<0, 1 if a>0 and 0 if a=0.
Torinthiel
--
Waclaw "Torinthiel" Schiller GG#: 542916, 3073512
torinthiel(at)megapolis(dot)pl
gpg: B06901F1 fpr: FAA3 559F CAE9 34DE CDC8 7346 2B6E 39F2 B069 01F1
"No classmates may be used during this examination"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040810/83963a2b/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list