# [MATRIX-SIG] integer division -- what a concept!

**Zane Motteler
**
zcm@llnl.gov

*Fri, 16 Jan 1998 14:14:32 -0800*

Charles,
You wrote
>*Paul F. Dubois writes:
*>*
*>* > Another way to look at it is, suppose you saw:
*>* >
*>* > x = i / j
*>* >
*>* > Wouldn't you be surprised that the type of x depended on the data?
*>* >
*>*
*>*I really don't understand this comment.
*...<snip>...
I think I know what Paul was trying to say (I better, I've been
working for him for 12 years ;-).
If i and j are the same type, then the "principle of least surprise"
says that x should be of the same type as i and j. If they are of
different types, then the outcome of course depends on the rule
of coercion, but generally one would expect x to be of the same
type as either i or j. To me at least (and I've been in computing
for 41 years now) it seems counterintuitive that the result of an
operation would be of a different type than either operand.
--Zane
-----------------------------------------------------------------
Zane C. Motteler, Ph. D.
Computer Scientist | Professor Emeritus of
Lawrence Livermore National | Computer Science and Engineering
Laboratory | California Polytechnic
P. O. Box 808, L-472 | State University
(7000 East Avenue, zip 94550) | San Luis Obispo, CA 93407
Livermore, CA 94551-9900 | zmottel@phoenix.csc.calpoly.edu
510/423-2143, FAX 423-9969 (Area code 925 after March 14, 1998)
zcm@llnl.gov
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________