\title{Appendix D: Summary of available Constants}

In this appendix we give the list of predefined constants available in the
PARI library. All of them are in the \idx{heap} and {\it not\/} in the PARI
\idx{stack}. We start by recalling the \idx{universal object}s introduced in
\secref{se:intro4}:
%
\bprog
t\_INT: gzero (zero), gun (un), gdeux (deux)
t\_FRAC: ghalf (lhalf)
t\_COMPLEX: gi
t\_POL: polun[] (lpolun[]), polx[] (lpolx[])
\eprog

\noindent The other objects are not initialized by default:

{\tt \idx{geuler}}. This is Euler's constant. To initialize it, call
{\tt\idx{consteuler}(prec)} (see \secref{se:euler}).

{\tt \idx{gpi}}. This is the number $\pi$. To initialize it, call
{\tt\idx{constpi}(prec)} (see \secref{se:pi}).

{\tt \idx{bern}}(i). This is the $2i$-th Bernoulli number ($B_0=1$, $B_2=1/6$,
$B_4=-1/30$, etc\dots). To initialize them, use the function:

{\tt void \idx{mpbern}(long n, long prec);}

This creates the even numbered Bernoulli numbers up to $B_{2n-2}$ {\it as
real numbers\/} of precision {\tt prec}. They can then be used with the macro
{\tt bern(i)}. Note that this is not a function but simply an abbreviation,
hence care must be taken that {\tt i} is inside the right bounds (i.e. $0\le
{\tt i}\le n-1$) before using it, since no checking is done in PARI itself.

Finally, one has access to a table of (differences of) primes through the
pointer {\tt \idx{diffptr}}. This is used as follows: when

{\tt void pari\_init(long size, long maxprime);}

\noindent is called, this table is initialized with the successives
differences of primes up to {\tt maxprime} (see \secref{se:intro4}). {\tt
maxprime} has to be less than $436272745$, whatever memory is available. A
difference of $0$ means we have reached the end of the table. The following
example illustrate its use.
%
\bprog
byteptr d = diffptr;
long p = 0;
\h
while (1) /* run through all small primes */
\obr
\q  p += *d;
\q  if (*d == 0) err(primer1); /* not enough primes */
\q  d++;
\q  ...
\cbr
\eprog\noindent
Here, we use the general error handling function {\tt err} (see
\secref{se:err}), with the codeword {\tt primer1}. This will just print the
error message:

{\tt *** not enough precomputed primes}

\noindent them abort the computations.

In addition, some single or double-precision real numbers are predefined,
and their list is in the file {\tt gencom.h}
\vfill\eject
