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

Charles G. Waldman cgw@pgt.com
Fri, 16 Jan 98 23:00 EST

Zane Motteler writes:

 > 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. 

To me, the "principle of least surprise" (and high-school algebra)
says that if b != 0, then b*(a/b) should be equal to a.  Values are
(to me) more important than types.  If we were to insist that division
always promotes its operands to float before dividing, and returns a
float, then 2*(1/2) returns 1.0, which, although not the same type as
the integer 1, represents the same value.  If you insist on being
type-centric, then 2*(1/2)==0 is true, which seems far weirder to me.

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org