I have some numbers which I need to convert to binary format, and this is one off time, but I'm not sure how I would fit the numbers in to perform the necessary conversion.
The numbers has 256 significant digits (actually I only needed 78 digits to create a 256 digit long binary representation). AFAICT, there aren't anything online or freely available that allows me to do conversion with such precision.
The problem is that the algorithm to convert from base 10 to base 2 requires that I repeatedly divide the remaining integer by 2 as I move from leftmost digit to the last:
e.g.
Convert 118 from base 10 to base 2
which becomes 1110110 (reading upward).
But the biggest number I can store is 4 million something. Because the numbers are fractional, it's quite important that I keep the significant digits so no fudging.
I would imagine in order to divide a large number, I'd need to hold a number of variable, split the large number into smaller number that variables can hold, then divide 2 with the first variable, and carry over the result into the second variable and so forth? Or maybe there's easier way?
The numbers has 256 significant digits (actually I only needed 78 digits to create a 256 digit long binary representation). AFAICT, there aren't anything online or freely available that allows me to do conversion with such precision.
The problem is that the algorithm to convert from base 10 to base 2 requires that I repeatedly divide the remaining integer by 2 as I move from leftmost digit to the last:
e.g.
Convert 118 from base 10 to base 2
Code:
118 ÷ 2 = 59 0
59 ÷ 2 = 29 1
29 ÷ 2 = 14 1
14 ÷ 2 = 7 0
7 ÷ 2 = 3 1
3 ÷ 2 = 1 1
1 ÷ 2 = 0 1
which becomes 1110110 (reading upward).
But the biggest number I can store is 4 million something. Because the numbers are fractional, it's quite important that I keep the significant digits so no fudging.
I would imagine in order to divide a large number, I'd need to hold a number of variable, split the large number into smaller number that variables can hold, then divide 2 with the first variable, and carry over the result into the second variable and so forth? Or maybe there's easier way?