A use for integer quotients
Michael Abbott
michael.g.abbott at ntlworld.com
Wed Jul 25 10:06:57 EDT 2001
Robin Garner <robin.garner at i.name.com> wrote in
news:Xns90E97C9849AD5robindotgarneratinam at 172.18.25.3:
> "michael" <serrano at ozemail.com.au> wrote in
> news:JDa77.97061$Rr4.549007 at ozemail.com.au:
>
> In most maths the sets are made explicit, and operators are defined as
> functions with specific domains. There are standard embeddings of
> Integers into Rationals and Reals, and if you are working with real
> numbers, then 2 and 2.0 are generally taken to stand for the same
> thing. But strictly speaking the Integer 2 and the Real Number 2 are
> different entities. You would be hard pressed to find anyone writing
> the natural number 2 as 2.0.
Indeed. The domain and sets of operations are crucial, and it is important
to keep integers and reals separate. Of course we know that there is a
injective mapping from integers to reals which preserves all sorts of nice
properties the integers (but *not* all properties), but integers are not
reals!
>
> Since the Integers aren't a field, there isn't a generally accepted
> function
>
> / : Int x Int -> Int.
>
> that agrees with the function
>
> / : Real x Real -> Real
>
> for all (a,b) where b is divisible by a.
However, since the integers are a "Euclidian domain", there is a function
divmod : Int x Int -> Int x Int
with the expected properties (where a/b is a plausible name for the first
half of the result of this operation).
More information about the Python-list
mailing list