# Correctness? Factorial implementation returning unexpected result

**URL:** <https://discourse.julialang.org/t/correctness-factorial-implementation-returning-unexpected-result/85944>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 18, 2022, 7:08pm UTC](https://discourse.julialang.org/t/correctness-factorial-implementation-returning-unexpected-result/85944 "2022-08-18T19:08:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![johnmyleswhite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnmyleswhite/32/31_2.png) [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)\
**Post date:** [August 18, 2022, 7:12pm UTC](https://discourse.julialang.org/t/correctness-factorial-implementation-returning-unexpected-result/85944/2 "2022-08-18T19:12:01Z")

</div>

[https://docs.julialang.org/en/v1/manual/faq/#faq-integer-arithmetic-1](https://docs.julialang.org/en/v1/manual/faq/#faq-integer-arithmetic-1)

> [@Tonight I hated julia, REPL and overflows](https://discourse.julialang.org/t/tonight-i-hated-julia-repl-and-overflows/34884/6):
>
> I have never seen an error message like that - all variables we create have concrete types. (You cannot redefine composite types without a REPL restart in the global scope, that’s true.) In most cases, you can call type names as constructors, in this case eg. BigInt(5). As jlapeyre mentioned, big(5) works here, too.

There are _a lot_ of threads on this topic if you search for machine integers, overflow and even factorial.

---

_[View the full topic](https://discourse.julialang.org/t/correctness-factorial-implementation-returning-unexpected-result/85944)._
