lua-users home
lua-l archive

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


In message <5130BE7E.2080503@gmail.com> you wrote:

> >> An idea for a project: replace the fp in Luas number for a pair of
> >> integers, a and b, representing the fraction a/b. Define operations
> >> accordingly, and modify the parser.

The difficulty with rational arithmetic is the unboundedness of
numerators and denominators if you want to keep values exact.

> It's a (non-fun) joke. There are no irrational numbers inside a 
> computer, unless you handle them symbolically (an irrational number has 
> infinite digits which are not a repetition of a sequence). So if we are 
> to handle only rationals, let be explicit on that.

No problem with algebraic numbers (of reasonably small degree). It
is the transcendental numbers that present problems. But even
these, using lazy streams of continued-fraction approximants, for
example, can be represented - so long as they are computable (by
sufficiently small programs). 

A lollipop to the first guy to handle non-computable numbers on
his computer ;).
-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/