(Edited to emphasize the point about assumptions).
Consider a simple integral:
Integrate[Exp[I x/2], {x, 0, 2 Pi}]
Mathematica produces the following answer: 4 I.
Consider now a different form of this integral:
Integrate[Sqrt[Exp[I x]], {x, 0, 2 Pi}]
This changes the answer to 4. This is presumably consistent with Mathematica's definition of the square root.
However, providing an assumption,
Integrate[Exp[I x/2], {x, 0, 2 Pi}, Assumptions -> x > 0]
Integrate[Sqrt[Exp[I x]], {x, 0, 2 Pi}, Assumptions -> x > 0]
makes both integrals produce the same answer, 4 I.
How come?
This was tested in Mathematica 13, Mathematica 14.2, and Mathematica 14.3.
This behavior was reported to Wolfram Support and confirmed to be a bug by them.





NIntegrate[Sqrt[Exp[I x]], {x, 0, 2 Pi}]- it confirms it is4. But we have branch cut atPiso if you treat this branch cut differently than default behavior of Mathematica then you may come to a different result. $\endgroup$Integrate[Sqrt[Exp[I x]], {x, 0, 2 Pi}, Assumptions -> x > 0]that gives wrong result. $\endgroup$Integrate[Sqrt[Exp[I x]], {x, 0, 2 Pi}]as you thought but inIntegrate[Sqrt[Exp[I x]], {x, 0, 2 Pi}, Assumptions -> x > 0]. $\endgroup$Sqrt+Assumptionscase is befouled. $\endgroup$