# My my factorial functions return 1 for any negative value

**URL:** <https://discourse.julialang.org/t/my-my-factorial-functions-return-1-for-any-negative-value/38035>\
**Category:** General Usage\
**Tags:** question\
**Created:** [April 22, 2020, 4:46pm UTC](https://discourse.julialang.org/t/my-my-factorial-functions-return-1-for-any-negative-value/38035 "2020-04-22T16:46:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![A.U.M](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@A.U.M](https://discourse.julialang.org/u/A.U.M)\
**Post date:** [April 22, 2020, 4:46pm UTC](https://discourse.julialang.org/t/my-my-factorial-functions-return-1-for-any-negative-value/38035/1 "2020-04-22T16:46:15Z")

</div>

Why my Factorial functions return 1 for any negative value always?

```julia
my_factorial(n::Integer)::BigInt = reduce(*, BigInt(1):BigInt(n))

```

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [April 22, 2020, 4:58pm UTC](https://discourse.julialang.org/t/my-my-factorial-functions-return-1-for-any-negative-value/38035/2 "2020-04-22T16:58:36Z")

</div>

When `n` is negative, the range is empty, and `reduce(*,)` starts with the multiplicative identity which is `1`.
