Arbitrary precision numbers.

Galanakis Dimitris digalan at the.forthnet.gr
Tue Feb 15 18:25:37 EET 2000


Ayto einai bebaia ligo ektos thematos alla exw dei kamposa paliotera
threads me analogo periexomeno. Einai ena aplo (?) problima
programmatismou. Thelw na kanw ena programma pou na kanei praxeis
apeiris akribeias. To texnasma pou xrisimopoiw einai oi "arithmoi" mou
na einai pinakes typou int (px int *number[LENGTH] , opou LENGTH mia
stathera). Kata diki mou symbasi oi arithmoi int pou tha xrisimopoiw tha
einai sto diastima apo 0..9999. Etsi tha mporw na typwsw enan tetoio
pinaka sxetika (tropos tou legein) apla. typwnontas me ti seira tous
arithmous. Tha thewrw aytous tous arithmous ws akeraious. Me to "psifio
mirkoteris simasias" sti thesi 0 ( diladi einai to number[0]) Apo ekei
kai pera prospathw na ftiaxw routines pou na kanoun ta stoixeiwdi,
prosthesi pollaplasiasmo ktl. Paradeigma routinas pou kanei prosthesi
einai i exis:

 int *plus(int *x,int *y){ //prosthetei tous "pinakes-arithmous" x kai y

int i, temp, *z;
z[0]=0;
for(i=0;i<LENGTH-1;i++){
   temp=x[i]+y[i];
   z[i+1]=temp/10000 //ypologismos kratoumenou
   z[i]=temp%10000
   }
//Elegxos gia overflow
temp=x[LENGTH-1]+y[LENGTH-1];
z[LENGTH-1]=temp%10000
if temp/10000!=0 return 0
   else return z;

Exw brei mia ligo periplokoteri routina gia pollaplasiasmo alla den
mporw na fantastw kapoion algorithmo tha tin diairesi!!! Exei kaneis
kamia idea? Episis an yparxei idea gia mia pio praktiki parastasi
arithmwn apeiris akribeias tha einai eyprosdekti
Elpizw na mi sas kourasa. bye
Galanakis Dimitris

--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr/lgu.html
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