Is cis returning correct results?

Maybe I am doing something wrong in my reasoning, but analytically

cis(x*y) == cis(x)^y

In code:

julia> # Using Float
julia> cis(5e7 * 2.0)
-0.3633850893556905 + 0.931639027109726im
julia> cis(5e7) ^ 2.0
-0.3633850893556906 + 0.9316390271097259im
julia> cis(5e7 * 2.1)
0.9880309286897708 + 0.15425590410881812im
julia> cis(5e7) ^ 2.1
-0.45202443071289305 + 0.8920055571792617im

# Using BigFloat
julia> cis(big"5e7" * big"2.1")
0.9880309286897708804616997563820610254357463259617987003319908268170075919850126 + 0.1542559041088181145159740301064797893361917687791464001837337459216975916488799im
julia> cis(big"5e7") ^ big"2.1"
-0.4520244307128928296616540228665411884609079531692781788401347090979223668926859 + 0.8920055571792617198358196686276885749193557554735942508409861455486149644639732im

Am I doing something wrong?

Thanks!

Are you sure cis(x*y) == cis(x)^y? These types of rules often don’t work since they depend on which branch of the complex logarithm you take.

You are right, and I am sorry! It seems it does not hold for non-integers.

I think exponent rules still apply to non-integer exponents if the base is a positive real number. Definitely not complex numbers in general e.g. (i^4)^0.5 = 1^0.5 = 1 != i^(4*0.5) = i^2 = -1. Hard to actually track down a clear summary extending the exponent rules beyond integer exponents.