Function: sqrt
Section: transcendental
C-Name: gsqrt
Prototype: Gp
Help: sqrt(x): square root of x.
Description:
 (real):gen           sqrtr($1)
 (gen):gen:prec       gsqrt($1, $prec)
Doc: principal branch of the square root of $x$, defined as $\sqrt{x} =
 \exp(\log x / 2)$. In particular, we have
 $\text{Arg}(\text{sqrt}(x))\in{} ]-\pi/2, \pi/2]$, and if $x\in \R$ and $x<0$,
 then the result is complex with positive imaginary part.

 Intmod a prime $p$, \typ{PADIC} and \typ{FFELT} are allowed as arguments,
 when the square root exists (an exception is raised if it does not).
 For other arguments, the result is undefined.

 \item \typ{INTMOD}: the chosen square root has a representative
 in the interval $[0,p/2]$ modulo $p$.

 \item \typ{PADIC}: the square root has the form $p^e u$ where the unit $u$
 matches the above choice modulo $p$ for odd $p$, resp.~is congruent to $1$
 modulo $4$ when $p = 2$. In particular if $x$ belongs to $1 + p\Z_p$
 (resp.~$1 + 8\Z_2$), then $\sqrt{x}$ belongs to $1 + \Z_p$ (resp.~$1 + 4\Z_2$).

Variant: For a \typ{PADIC} $x$, the function
 \fun{GEN}{Qp_sqrt}{GEN x} is also available.
