A use for integer quotients

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Jul 23 17:48:57 EDT 2001


Mon, 23 Jul 2001 22:34:07 +0100, Stephen Horne <steve at lurking.demon.co.uk> pisze:

>>No no no.  '3.' i.e. a floating point number with that value could be 
>>anything in that range.  '3' means exactly the integer 3, no approximation 
>>at all.
> 
> A mathematician is free to use '3' to represent a real - the fact that
> it is real is implicit in the context. Compilers and interpeters
> aren't able to determine that, so integers and floats have different
> notations even when the represent equivalent values.

When we are considering exactness, value is not the only thing that
matters. 3 and 3. have the same value and the primary difference is that
3 is integer, discrete, exact, where 3. is real, analog, continuous,
fuzzy.

> We can't exactly match mathematics here, but we don't have to go so
> far as having different symbols for integer and float division -
> mathematics uses the same set of symbols for both operations allowing
> the context choose the operator.

I've never seen / as integer division in mathematics. The only notation
I know is

  |  a  |
  |  -  |
  |_ b _|

i.e. floor(a/b).

Even an operator for modulo is rarely used at all. More common are
congruences
  x === y === z (mod m)
where === denotes three horizontal lines. If modulo is used directly,
it's 'x mod y'.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list