Cannot calculate factorials bigger than 20! ! How to do so?

后端 未结 7 511
清歌不尽
清歌不尽 2020-12-03 08:16

I am using unsigned long long integer format in order to calculate big factorials. However my code fails at some point can you have a look at it? Actually it is part of a la

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 08:47

    A long long is only so big, and thus can only represent numbers so big. If you need an exact representation of bigger integers, you'll need to use something else (some 3-rd party library or some datatype you make yourself); if you don't need it to be exact, then you could use double's instead.

提交回复
热议问题