Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.c Subject: Re: int divided by unsigned. Message-ID: <13959@lanl.gov> Date: 27 Jun 89 22:36:08 GMT References: <18296@mimsy.UUCP> Distribution: na Organization: Los Alamos National Laboratory Lines: 16 From article <18296@mimsy.UUCP>, by chris@mimsy.UUCP (Chris Torek): > Instead of simply asserting `it is obvious that ...', you might explain > why you feel that way, for those of us to whom it is not obvious. In every other programming language I am familiar with, integer division is guaranteed to produce a result which is smaller than (or equal to) the numerator in absolute value. That is, you can count on the following relation: | a/b | <= | a | Other languages which have unsigned either don't allow mixed mode at all (like Modula I, II, etc) or they treat unsigned as inferior to inferior to signed for automatic conversion. This later decision conforms to intuition (ie. the relation above) more often than the procedure C uses. But, as I say, C rarely obeys the principle of least astonishment.