Function: bnfisunit
Section: number_fields
C-Name: bnfisunit
Prototype: GG
Help: bnfisunit(bnf,x): bnf being output by bnfinit, gives
 the column vector of exponents of x on the fundamental units and the roots
 of unity if x is a unit, the empty vector otherwise.
Doc: \var{bnf} being the number field data
 output by \kbd{bnfinit} and $x$ being an algebraic number (type integer,
 rational or polmod), this outputs the decomposition of $x$ on the fundamental
 units and the roots of unity if $x$ is a unit, the empty vector otherwise.
 More precisely, if $u_1$,\dots,$u_r$ are the fundamental units, and $\zeta$
 is the generator of the group of roots of unity (\kbd{bnf.tu}), the output is
 a vector $[x_1,\dots,x_r,x_{r+1}]$ such that $x=u_1^{x_1}\cdots
 u_r^{x_r}\cdot\zeta^{x_{r+1}}$. The $x_i$ are integers for $i\le r$ and is an
 integer modulo the order of $\zeta$ for $i=r+1$.

 Note that \var{bnf} need not contain the fundamental unit explicitly:
 \bprog
 ? setrand(1); bnf = bnfinit(x^2-x-100000);
 ? bnf.fu
   ***   at top-level: bnf.fu
   ***                     ^--
   *** _.fu: missing units in .fu.
 ? u = [119836165644250789990462835950022871665178127611316131167, \
        379554884019013781006303254896369154068336082609238336]~;
 ? bnfisunit(bnf, u)
 %3 = [-1, Mod(0, 2)]~
 @eprog\noindent The given $u$ is the inverse of the fundamental unit
 implicitly stored in \var{bnf}. In this case, the fundamental unit was not
 computed and stored in algebraic form since the default accuracy was too
 low. (Re-run the command at \bs g1 or higher to see such diagnostics.)
