The most common way is to get the power of 2 for each non-zero position of the binary number, and then sum them up. This is not workable when the binary number is huge, say, 

10000...0001 //1000000 positions

It is impossible to let the computer compute the pow(2,1000000). So the traditional way is not workable.

Other way to do this?

Could someone give an arithmetic method about how to compute, *not library*?