Thomas Baruchel on Sun, 22 Sep 2002 17:09:54 +0200


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

New GP user


Hi,

I'm very new to Pari-GP. I used bc/calc/aribas before, but I
just switched to GP, because of LLL and other features ;-)

Here are my first troubles:
  a) I wrote a function which approximates a real number
     by computing an integer divisions (two huge integers).
     For me, it has no sense to get
       f(x) = 1249999999999999999999/10000000000000000000000
     (in fact it is much more ugly because denominator is a
     huge prime number).
     The best I found is to return:
       a/b+.0
     is it the best way ?
  b) 'calc' has a 'swap' feature:
     swap(a,b) in order to exchange the value of a and b
     With GP, I couldn't find better than:
       t=a;
       a=b;
       b=t;
     is there a more elegant way of doing it ?

Thank you very much,

-- 
'\   (define Thomas_Baruchel
  \    ((lambda (k) (k k))
  /\     (call-with-current-continuation
 /  \      (lambda (k) (k k)))))              thomas.baruchel # libertysurf.fr