Wolfram alpha says that $\int_{-\infty}^\infty e^{-ix^2}dx = \sqrt{\frac{\pi}{i}}$ Wolfram alpha says that 
$$
\int_{-\infty}^\infty e^{-ix^2}dx = \sqrt{\frac{\pi}{i}}$$
holds. But it has two different values ($\sqrt{i}$). 
How should I understand this?
 A: Wolfram Alpha seems to be using this formula
$$
\begin{align}
\int_{-\infty}^\infty e^{-ax^2}\,\mathrm{d}x
&=\frac1{\sqrt{a}}\int_{-\infty}^\infty e^{-x^2}\,\mathrm{d}x\\
&=\sqrt{\frac\pi{a}}\tag{1}
\end{align}
$$
which is valid for real $a\gt0$, where there is no confusion as to what the square root means.
However, we can use contour integration to get the proper result.
Since $e^{-z^2}$ is entire,
$$
\int_\gamma e^{-z^2}\,\mathrm{d}z=0\tag{2}
$$
over any closed contour $\gamma$ ; for example, $[R,-R]\cup-Re^{i\pi[0,1/4]}\cup e^{i\pi/4}[-R,R]\cup Re^{i\pi[1/4,0]}$:
$\hspace{5cm}$
As $R\to\infty$, the integral over the diagonal path, where $z=\frac{1+i}2x$ and $-z^2=-ix^2$, is equal to
$$
\int_{-\infty}^\infty e^{-ix^2}\tfrac{1+i}{\sqrt2}\,\mathrm{d}x=\tfrac{1+i}{\sqrt2}\int_{-\infty}^\infty e^{-ix^2}\,\mathrm{d}x\tag{3}
$$
and the integral over the horizontal path, where $z=x$, is
$$
-\int_{-\infty}^\infty e^{-x^2}\,\mathrm{d}x\tag{4}
$$
As shown below, the integral over the curved segments vanish as $R\to\infty$, we get from $(2)$ that the sum of the integrals in $(3)$ and $(4)$ is $0$. That is,
$$
\begin{align}
\int_{-\infty}^\infty e^{-ix^2}\,\mathrm{d}x
&=\tfrac{1-i}{\sqrt2}\int_{-\infty}^\infty e^{-x^2}\,\mathrm{d}x\\
&=(1-i)\sqrt{\frac\pi2}\tag{5}
\end{align}
$$

Curved Contours
On the right hand curve, $z=Re^{it}$ for $t\in[0,\pi/4]$. Therefore,
$$
\begin{align}
\left|\,\int_\gamma e^{-z^2}\,\mathrm{d}z\,\right|
&=\left|\,\int_0^{\pi/4}e^{-R^2e^{2it}}iRe^{it}\,\mathrm{d}t\,\right|\\
&\le\int_0^{\pi/4}e^{-R^2\cos(2t)}R\,\mathrm{d}t\\
&\le\int_0^{\pi/4}e^{-R^2(1-4t/\pi)}R\,\mathrm{d}t\\
&=\frac{\pi}{4R}\int_0^{R^2}e^{-u}\,\mathrm{d}u\\
&\le\frac{\pi}{4R}
\end{align}
$$
The left hand contour is similar.
A: Hint
I think that I see where is the confusion $$\int e^{-a x^2}dx =\frac{\sqrt{\pi } \text{erf}\left(\sqrt{a} x\right)}{2 \sqrt{a}} $$ $$\int_{-\infty}^\infty e^{-a x^2}dx = \frac{\sqrt{\pi }}{\sqrt{a}}$$ but, in principle, this is true (at least to me) only if $\Re(a)>0$. 
As AlexR commented, his result is $$\int e^{-i x^2}dx = (1-i) \sqrt{\frac{\pi }{2}}$$ But, what is interesting is that $$\sqrt{\frac{1}{i}}=\sqrt{-i}=\sqrt{e^{3i\pi/2}}=e^{3i\pi/4}=\frac{1-i}{\sqrt{2}}$$
A: Supplementing the other good answers and comments: the ambiguity in choice of $i$ exists on both sides, in the first place.
Second, one might want to check that the integral really does converge, that is, for example, that $\lim_T \int_0^T e^{ix^2}\;dx$ exists. This is perhaps easier to see by making a change of variables, replacing $x$ by $\sqrt{x}$, so looking at $\lim_T \int_0^T {e^{ix}\over \sqrt{x}}\;dx$, which is indeed convergent by some variant of an alternating-decreasing criterion.
Then evaluation of the original integral by analytic continuation and/or contour-integrals (as in the other answers) is perhaps more plausible.
A: In most situations $i$ can be treated like any real constant during integration and simplification with other terms using  $i^2 = -1$.
