function result = FresnelI(x)

%***********************************************************************
%     Computation of the complex Fresnel integral
%***********************************************************************

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% f=inline('exp(-i*t.^2)');
% lim=sqrt(x);
% integral=quad(f,lim,10^6);
% result=-i*2*lim*exp(i*x)*integral;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[C,S]=fresnelCS(sqrt(x*(2/pi)));

A=sqrt(2*pi*x)*exp(x*i)*i;
B=(1/2-C)-(1/2-S)*i;
result=A*B;

