小编Shi*_*del的帖子

How to calculate pow(2,n) when n exceeds 64 in c++?

So, I am new to programming in c++ and i came across this question where i need to calculate pow(2,n)/2 where n>64 ?

i tried using unsigned long long int but as the limit of the c++ is only 2^64. So is there any method to calculate this.

Edit:

 1 < n < 10^5
Run Code Online (Sandbox Code Playgroud)

The result of the expression is used in further calculation

The question is asked on online platform.So, i cant use libraries like gmp to handle large …

c++ unsigned-integer c++11

6
推荐指数
2
解决办法
186
查看次数

标签 统计

c++ ×1

c++11 ×1

unsigned-integer ×1