Bill Allombert on Fri, 25 Apr 2008 12:21:40 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
new alarm GP function |
Dear PARI users, I just added the function alarm to GP (svn branch), alarm({s = 0}): trigger an alarmer exception after s seconds, cancelling any previously set alarm. Stop a pending alarm if s = 0 or is omitted. For example, the function timefact(N,sec) below will try to factor N and give up after sec seconds, returning a partial factorisation. default(factor_add_primes,1); default(primelimit,16777216); timefact(N,sec)= { trap(alarmer,0,alarm(sec);factor(N);alarm(0)); factor(N,16777216); } Cheers, Bill.