Integer division

Laura Creighton laura at hoptoad.uucp
Wed Feb 5 00:21:22 AEST 1986


In article <11689 at ucbvax.BERKELEY.EDU> weemba at brahms.UUCP (Matthew P. Wiener) writes:
>....  There are several identities
>running around that are incompatible.
>
> (1)	      a == (a/b) * b + a%b
> (2)	 (-a)/b == -(a/b)
> (3)	(a+b)/b == a/b + 1
> (4)	(a+b)%b == a%b
>
>Notice that (3) and (4) are compatible with what the number theorists want,
>but (2) isn't.  Sure the naive user is fooled by (2) under the version we
>want, but then he's fooled by (3) and (4) in the usual version.  (1) holds
>when the / and % are both what the number theorist wants or when neither are
>what the number theorist wants.

While it is true that number theorists want 3 and 4, it is not the naive user
who will be fooled by 2.  It is the naive *mathematician*, which is just about
everybody.  To non-mathematicians, 2 is a law, with about the same force as
the law of gravity, and not something that you can redefine.

Sure they are wrong about the force of this law -- but blame the way mathematics
is taught in hich schools and grade schools.  In the meantime, only the 
mathematicians, as a class, will have the perspective to see this. Everybody
else (again as a class) will look at (-a)/b != -(a/b) and say ***BUG!!!***
So, as a practical matter, the mathematicians will have to come up with a
work-around, since only they are going to be able to understand what they want.
In letting non-mathematicians design the languages they use, mathematicians
may have seriously goofed, because the non-mathematicians may not understand
what it is that the mathematicians want -- if they did they would be 
mathematicians.  Of course, I am not sure that there is consensus among
mathematicians as to what they want.  If there is, maybe they should write
their own language.

[I'm glad I wrote that last line.  It tells me where to post this fool thing,
which has been in the back of my mind, bothering me, the whole time I was
writing this.  Before that, I was strongly tempted to post to net.philosophy...]
-- 
Laura Creighton		
ihnp4!hoptoad!laura 
hoptoad!laura at lll-crg.arpa



More information about the Comp.lang.c mailing list