For $a \in \mathbb{R},a>0 $ the Gaussian integral is $$ \begin{equation} \int_{-\infty}^{\infty} e^{-ax^2} dx = \sqrt{\frac{\pi} {a}} . \hspace{1cm} (1) \end{equation} $$
What happens if we choose $a$ to be a complex number, let's say $-i$. Then, according to the formula above we would get (I am not sure if this is allowed ?) $$ \int_{-\infty}^{\infty} e^{ix^2} dx = \sqrt{i \pi} = \frac{(1+i)\sqrt{\pi}}{\sqrt{2}}.$$ But interestingly enough, Wolfram Alpha gives the same result.
Using Residue calculus we get
$$ \int_{-R}^{R} e^{ix^2} dx = - \int_{\gamma} e^{iz^2} dz, $$ where $\gamma$ is a semicircle in the upper half plane of radius R. With $t\to Re^{it}$ the rhs becomes:
$$ \int_{0}^{\pi} e^{iR^2 e^{2it}} iRe^{it} dt. $$ But how can that converge for $R \to \infty$? For example take $t=0$: We would have $ i Re^{iR^2}$, which for $R \to \infty$ goes to $\infty$ as $e^{ix^2}$ is bounded by $1$. Considering the above finite result, what is wrong here? Maybe we have to apply some distributional tools? Is it then just coincidence that formula $(1)$ worked?
Having stated this, can anyone help me out of this confusion?