Binary conversion without BIN2DEC

Hi

Due to the lack of large bits with this function, I am in need of a function that can convert large numbers to binary and vice versa. Does anyone have any ideas?

Thanks in advance.

MacBook Pro 17" 2.6GHz 6GB 500GB 512MB 8600M GT GDDR3, Mac OS X (10.6.2), 23" Cinema Display, G5 Quad, 1GHz Titanium, iPod Touch 32GB, MacBook Pro 2.4GHz

Posted on Apr 14, 2010 10:42 PM

Reply
12 replies

Apr 15, 2010 12:47 AM in response to A Yilmaz

May you be more precise ?
Number is unable to make a difference between
1234567890123451
and
1234567890123453

It will treat both as
1234567890123450

On the other hand, it is able to convert in BIN every integer with 15 digits

So, I don't understand what you wish to get.
If you wish to decipher integers with more than 15 digits, you must use an other tool or you must work with strings and use an AppleScript to decipher these strings.

In fact the Numbers behaviour is a bit more complicated.
User uploaded file
In cell B2 I entered :
=1234567890123450+4
In cell B3 I entered :
=1234567890123450+2
In cell B4
I entered :
=B2=B3
which returns TRUE
In C2 and C3, I entered :
=DEC2BIN(B)

As you may see, with two numbers treated as EQUAL by B4, it returns different results.
And,
more funny, the formula
=C2=C3 inserted in C4 returns TRUE 😉 😟

Yvan KOENIG (VALLAURIS, France) jeudi 15 avril 2010 09:47:12

Apr 15, 2010 6:19 AM in response to Jerrold Green1

No not exactly. I've tried a few different functions and played around with them for a bit. Problem is that it only converts the 1st digit to binary and ignores the rest. This for instance.

=SUM(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)*(2^(LEN(A1)-ROW(INDIRECT("1:"&LEN(A1) )))))

Where A2 are the relevant figures.

It's working, but it's not. for example. 1011 will report 8 instead of 11 as the function recognises the first digit on the left.

Apr 15, 2010 6:20 AM in response to A Yilmaz

Converting binary to decimal is an extremely simple procedure. You don't need formulas. If you format the binary cell as numeral system base 2 and the decimal cell as numeral system base 10, a simple equals sign will do it. That'll get you to 52 binary digits.

Fortunately, that does not satisfy the condition that you are to develop a FORMULA to do it for you homework.

Apr 15, 2010 6:45 AM in response to A Yilmaz

If your assignment is to develop a single formula, it will be a very long one. This is something that will require multiple formulas, each looking at a specific digit and multiplying it by the correct power of 2. There are a couple of ways to do that. Then you will sum them all up. Maybe (just maybe) in Excel it could be done in an array formula but we don't have that in Numbers. It could also be done with an Applescript, just like the examples I see for Excel (via Google search) that use Visual Basic.

Converting binary to decimal is also a collection of functions. In this case they divide by two and keep track of the remainder (a zero or one) then you assemble all those zeros and ones into a binary number.

That's all the hints I'll give. I am assuming you covered the mechanics of the conversion in class so this isn't any big news to you.

Apr 15, 2010 6:44 AM in response to Badunit

The problem is, it MUST be in excel or in this case Numbers. The above formula works quite well, but only for the 1st digit. It is blind to trailing digits and treats them as zeros. Another thought I had was maybe to include every digit into individual cells than convert them one by one. This would however take up a lot more space and be much less elegant.

Apr 15, 2010 6:55 AM in response to A Yilmaz

Is the assignment to design a spreadsheet that will convert from binary to decimal or is it to develop a formula (i.e., all in one cell)? Conversion from one to the other is an iterative process. It is a simple formula repeated multiple times and, to the best of my knowledge, requires either a program or multiple cells in a spreadsheet.

If it has to be done in a single cell in a spreadsheet application, impress you teacher with the equals operation in Numbers. But also do it the hard way if you want to get credit.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Binary conversion without BIN2DEC

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.