Function: idealappr
Section: number_fields
C-Name: idealappr0
Prototype: GGD0,L,
Help: idealappr(nf,x,{flag=0}): x being a fractional ideal, gives an element
 b such that v_p(b)=v_p(x) for all prime ideals p dividing x, and v_p(b)>=0
 for all other p. If (optional) flag is non-null x must be a prime ideal
 factorization with possibly zero exponents.
Doc: if $x$ is a fractional ideal
 (given in any form), gives an element $\alpha$ in $\var{nf}$ such that for
 all prime ideals $\goth{p}$ such that the valuation of $x$ at $\goth{p}$ is
 non-zero, we have $v_{\goth{p}}(\alpha)=v_{\goth{p}}(x)$, and
 $v_{\goth{p}}(\alpha)\ge0$ for all other $\goth{p}$.

 If $\fl$ is non-zero, $x$ must be given as a prime ideal factorization, as
 output by \kbd{idealfactor}, but possibly with zero or negative exponents.
 This yields an element $\alpha$ such that for all prime ideals $\goth{p}$
 occurring in $x$, $v_{\goth{p}}(\alpha)$ is equal to the exponent of
 $\goth{p}$ in $x$, and for all other prime ideals,
 $v_{\goth{p}}(\alpha)\ge0$. This generalizes $\kbd{idealappr}(\var{nf},x,0)$
 since zero exponents are allowed. Note that the algorithm used is slightly
 different, so that
 \bprog
   idealappr(nf, idealfactor(nf,x))
 @eprog\noindent
 may not be the same as \kbd{idealappr(nf,x,1)}.
