lua-users home
lua-l archive

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

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

It can always be defined.  For example, in the complex representation
mag*e^theta, you could use relational operators to indicate relative
magnitudes.  Of course, there's no uniqueness, but it's still useful.
I think the real argument for not make lua_Number complex is memory