lua-users home
lua-l archive

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

On Tue, Aug 9, 2011 at 06:58, David Kastrup <> wrote:
> Lexicographic order is ordering first by real part, then (on equality)
> by imaginary part.  Or vice versa.  It preserves that equivalence for
> any positive real constant.

No, it does not. Under lexicographic order (real first, imaginary
second) number i=sqrt(-1)
is a positive number because i>0 in lexicographic order. It leads to
i*x<i*y inconsistent with x<y for quite a few x,y pairs.
E.g.: x=1-3i; y=2+i; x<y but i*x>i*y

Complex numbers are not an ordered field [1], that is, you cannot
define an ordering which is consistent with arithmetic operations [2]
For no better reference at hand, here are two relevant Wikipedia articles


In any case, real numbers (being a subset of complex numbers) possess
certain unique properties that justify supplying them as a distinct
datatype. Having complex numbers as the only numeric datatype (typedef
complex lua_Number) would make life unnecessary complicated.