| Karim Belabas on Mon, 10 Dec 2012 17:54:37 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Prevent PARI from determining program |
* Sören Lennart Berg [2012-12-10 17:28]:
> the program I'm working on essentially runs a huge for loop. This
> means millions or even billions of loop cycles. In every iteration
> PARI is used to compute different things, for example polynomial
> roots, resultants and more. However, in rare cases PARI might crash
> due to faulty arguments(causing division by zero for example), a too
> small PARI stack or bugs. Unfortunately PARI then determines the
> program. Is there a way to avoid this behaviour? Can I reinitialise
> the PARI system and keep going? If the program crashes all
> computations would be in vain.
If you only use 'gp', then you can use
trap() in pari-stable (2.5.*)
iferr() / iferrname() in pari-testing (git repository only)
If you actually use the PARI library, a proper interface is available
(and documented) in pari-testing only, see Section 4.9 "Catching exceptions"
in the "User's Guide to the Pari library".
Cheers,
K.B.
--
Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France) http://pari.math.u-bordeaux1.fr/ [PARI/GP]
`