lua-users home
lua-l archive

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

In message <> 
you wrote:

> On Fri, Aug 5, 2011 at 9:40 AM, Lorenzo Donati
> <> wrote:
> > I was wondering whether "porting" Lua to C99, i.e. using C99 features to
> > enhance it, would allow some real advantages over C90.

> ...  Scientific people tend to think of floating-point
> numbers as a specialization of complex numbers, but they are the
> minority.

Engineers maybe (no flame intended) but not mathematicians. Complex
numbers extend integers in two ways: having a square root of -1 and
completeness (every Cauchy sequence has a limit). The latter property 
is impossible to implement on a computer so it comes down to what 
fudges you choose to make. Most people are brainwashed into thinking 
that the IEEE notion of floating point is handed down on tablets of stone. 
The trouble is, addition and multiplication cannot be commutative 
( x + y == y + x) or associative ( x + ( y + z ) == ( x + y ) + z ) 
for floating point numbers. There are other formats which are 
( e.g. lazy lists of modular transformations ) but they have severe 
drawbacks for storage. For references see  Prof. Abbas Edalat's thesis.

The trouble with floating point numbers is not so much their inherent
mathematical inadequacy, but their popularity. They eclipse from
view other possible implementations of numbers, which might well 
be a better solution in a particular problem-domain. In other words,
they tend to dissuade people from thinking about numbers, those horrid
things ;). What a relief to leave it all to the CPU/FPU!

Gavin Wraith (
Home page: