lua-users home
lua-l archive

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


Leo Razoumov <slonik.az@gmail.com> writes:

> Actually, making lua_Numbers complex is a bad idea. Complex numbers do
> not have a natural ordering relationship like real numbers do.
> With integers or real numbers you can assert that for any x,y
>
> assert((not (x<y) and not (y<x)) == (x==y))
>
> For complex numbers such an ordering operator does not exist.

Lexicographical ordering works just fine and fulfills that condition.
You could also just order the bit patterns.  Lots of other
possibilities.

They are not useful in the context of saying anything about Cauchy
sequences, but fine for creating n log n algorithms requiring a
dependable sorting order.

-- 
David Kastrup