# Factorial function of a real number of complex number

**URL:** <https://discourse.julialang.org/t/factorial-function-of-a-real-number-of-complex-number/80911>\
**Category:** Numerics\
**Created:** [May 11, 2022, 8:12pm UTC](https://discourse.julialang.org/t/factorial-function-of-a-real-number-of-complex-number/80911 "2022-05-11T20:12:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marouane1994](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Post date:** [May 11, 2022, 8:12pm UTC](https://discourse.julialang.org/t/factorial-function-of-a-real-number-of-complex-number/80911/1 "2022-05-11T20:12:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Post date:** [May 11, 2022, 8:34pm UTC](https://discourse.julialang.org/t/factorial-function-of-a-real-number-of-complex-number/80911/2 "2022-05-11T20:34:19Z")

</div>

`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

```julia
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`.

---

<div class="post-metadata">

**Author:** ![marouane1994](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Post date:** [May 11, 2022, 9:53pm UTC](https://discourse.julialang.org/t/factorial-function-of-a-real-number-of-complex-number/80911/3 "2022-05-11T21:53:25Z")

</div>

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