[MPlayer-dev-eng] [PATCH] cropdetect
Joey Parrish
joey at nicewarrior.org
Tue Aug 10 23:40:04 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
Yes, in fact. Your example:
Left-hand side:
(2 - 4) = -2. (a - b)
-2 is congruent to 1 mod 3. ((a - b) % c)
Right-hand side:
2 is congruent to 2 mod 3. (a % c)
4 is congruent to 1 mod 3. (b % c)
(2 - 1) = 1. ((a % c) - (b % c))
1 is congruent to 1 mod 3. (((a % c) - (b % c)) % c)
Both sides are the same.
QED.
Does C do stupid things with negative number and modulo math?
Because in math, this works...
I'm too lazy to test. If C breaks math, it's not math's fault. :)
--Joey
--
"The Hell Law says that Hell is reserved exclusively for them that believe
in it. Further, the lowest Rung in Hell is reserved for them that believe
in it on the supposition that they'll go there if they don't."
HBT; The Gospel According to Fred, 3:1
More information about the MPlayer-dev-eng
mailing list