lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In message <500E9E7B-B73A-4C87-9E24-6A238371BDEF@dnainternet.net> you wrote:

> How should the % operator be defined for complex numbers, then?  :)

There is no point in having % for reals or complexes; nor for any field.
It is useful for principal ideal domains whose nontrivial quotients
are finite, e.g. the integers, or the Gaussian integers (if you want
some complex numbers). Call a Gaussian integer x+iy "first quadrant"
if x>0 and y>=0. Then one can define quotient q and remainder r of two
Gaussian integers a and b, with b nonzero,  such that a = b*q+r,
where r belongs to the first quadrant or is zero and has absolute value (distance from 0) less than that of b. This r is the right definition
of a%b and it has the property that a1%b == a2%b only when a1-a2
is a multiple of b.

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/