2 questions (big numbers + HD vs DD)

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Nov 19 11:52:13 EET 1999


Ioannis Ioannou <roryt at hol.gr> writes:

> Giorgos Keramidas wrote:
> > 
> > An kai se glwsses opws h LISP apo oti thymamai den xreiazetai na kaneis
> > esy tipota gia na xrhsimopoihseis bignums, alla akoma kai apla kommatia
> > kwdika opws to:
> > 
> >         (defun fact (n)
> >           (cond ((< n 0) 0)
> >                 ((< n 2) 1)
> >                 (else (* n (fact (- n 1))))))
> 
> 
> Axmm....nai kai na pareis to stack sou sto xeri :-) Kai fysika akribws
> to idio paradeigma mporeis na to fiakseis kai se C kai se Pascal, kai se
> oles tis glwsses pou ypostirizoun recursion (akomi kai se Cobol me Local
> Storage Area mporeis !!)

Kai fusika stin C, Pascal, klp. an den ulopoihseis mia bibliothiki pou
na sou dinei dunatotita prakseon me megaaalous arithmous, tha pareis ki
ena overflow gia na matheis.

Emena pantos to parapano paradeigma stin Kyoto Common LISP (clisp 8a tin
deite sinithos aytin ston package manager sas) bgazei mia xara to
paragontiko tou 1000, tou 2000, klp.  Se C, to gnosto non-recursive
implementation bgazei overflow [pws briskei kaneis oti ekane overflow
einai ena allo thema, giati stous akeraious bliepeis i C theorei pos ta
kserei ola apo gennisimiou tis, kai den exei elegxo ensomatomeno].

Oso gia to recursion, ekeino to (else ...) mporei aneta na ulopoih8ei me 
swsto tail-recursion kai telika to recursive (fact n) na trwei ligotero
xwro sto stack, molis ena frame.

-- 
Giorgos Keramidas, <keramida at ceid.upatras.gr>
"What we have to learn to do, we learn by doing." [Aristotle]
--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr/archives
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users at hellug.gr
====================================================================



More information about the Linux-greek-users mailing list