I wanted to convert a number to binary so i used the classic algorithm to solve the problem but at some point i don't get the true value because i exceed the max value of int
is there any other solution to find the binary representation of lager numbers, beside using long
or long long
?
If your numbers are outside the range that your machine can natively represent then you will have to switch to arbitrary-precision math. Find the largest power of two smaller than your target number, subtract, find the next largest subtract again and so on until you have nothing left.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.