lua-users home
lua-l archive

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

Leo Razoumov <> writes:

> 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.

What about "any positive _real_ constant" did you not understand?

> 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

I am not all too worried about that, because it only works for a subset
of the real constants (namely the positive reals) either.  So the
distinction seems rather artificial.  The positive reals seem a better
ordered subset than all reals, as well.

If we define "positive" not by the rather artificial criterion ">0" but
by "k is positive if k*a > k*b <=> a>b" and negative similarly, this
works quite fine.  We just have to accept that there are numbers that
are neither positive, nor negative, nor zero.

> Complex numbers are not an ordered field [1], that is, you cannot
> define an ordering which is consistent with arithmetic operations [2]

That's apparently accepted nomenclature, but I have to say that I find
this use of "consistent" rather arbitrary.

> For no better reference at hand, here are two relevant Wikipedia articles
> [1]
> [2]
> 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.

Hardly, since you would not notice the difference as long as you stayed
within the reals.  It would make life unnecessarily inefficient in many
cases, but that's a different topic than the claimed "inconsistencies"
which I consider mostly ridiculous.

David Kastrup