Factorial function of a real number of complex number

I’m on Julia@1.7.2 and i put x=0.0 + 0.12008239133631671im factorial(x) i get an error , MethodError: no method matching factorial(::ComplexF64) the same thing if x is Float64 i get MethodError: no method matching factorial(::Float64)
but in Julia@1.5 i write the same thing x=0.0 + 0.12008239133631671im factorial(x) i get this output 0.9859392250075061 - 0.06776624698996092im, how can i get the same output in the 1.7 version?

factorial only accepts integers currently. I don’t know if it allowed real or complex types in the past.

Presumably you want a gamma function? You can access it from SpecialFunctions.jl

using Pkg
Pkg.add("SpecialFunctions")
using SpecialFunctions
x = 4
gamma(x+1) == factorial(x)  # true
x=0.0 + 0.12008239133631671im
gamma(x+1)

gives 0.9859392250075061 - 0.06776624698996092im.

2 Likes

i just found out that SpecialFunctions.jl removed Base.factorial(x::Number)