I am a supporter of
St. Joseph's hospice.
 If you find this site useful or if it helped you, consider a small donation to
St. Joseph's, please.

Information on
St. Joseph's

JustGiving - Sponsor me now!

 

sbLongDec2Bin

What is the binary representation (with bitlength = 256) of the decimal number -872362346234627834628734627834627834628? Don't ask Excel's built-in function dec2bin(). It cannot handle numbers greater than 511.
If you want to get the correct answer
1111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111101011011111011010100011111
1001110111100101111001000010000111010110010010100110011010001001100111101010
0001010101001011110011111100 then have a look at the functions listed below.

I intend to enhance the functionality. So far fractional parts are possible only for positive decimals which will be transformed into binaries by sbLongDec2Bin(). The decimal 0.5 is in binary format equal to 0.1, for example.

Function

Parameter 1

Parameter 2

Result

Comment

sbbinneg

0

 

0

 

sbbinneg

1

 

1111111111111111
1111111111111111

Implicite bitlength is 32

sbbinneg

11111111111
11111111111
1111111111

 

1

 

sbbinneg

10000000000
00000000000
0000000000

 

#VALUE!

Correct error value

sbbinneg

0

2

0

 

sbbinneg

1

2

11

 

sbbinneg

11

2

1

 

sbbinneg

10

2

#VALUE!

Correct error value

sbdivby2

0

TRUE

0

 

sbdivby2

2

TRUE

1

 

sbdivby2

1024

TRUE

512

 

sbdivby2

3.14159265

FALSE

1.570796325

 

sbdivby2

0.5

FALSE

0.25

 

sbdivby2

0.25

FALSE

0.125

 

sbdivby2

0.125

FALSE

0.0625

 

sbdecadd

0

0

0

 

sbdecadd

0.0001

0.9999

1

 

sbdecadd

123.456

987.654

1111.11

 

sblongdec2bin

2005

 

11111010101

 

sblongdec2bin

2005

11

#VALUE!

Now 2005 is too big

sblongdec2bin

11.5

 

1011.1

 

sblongdec2bin

2.25

 

10.01

 

sblongbin2dec

1111

 

15

 

sblongbin2dec

1111

4

-1

 

longbin2dec

11.11

 

3.75

 

20110321_PB_01_sbLongDec2Bin_Code
20110321_PB_02_sbLongDec2Bin_Code
20110321_PB_03_sbLongDec2Bin_Code
20110321_PB_01_sbLongBin2Dec_Code
20110321_PB_02_sbLongBin2Dec_Code
20110321_PB_03_sbLongBin2Dec_Code

If you are interested in downloading a 49 KB Excel 2010 sample file go to my Download page, please.

20110321_PB_01_sbDivBy2_Code
20110321_PB_02_sbDivBy2_Code
20110321_PB_01_sbBinNeg_Code
20110321_PB_02_sbBinNeg_Code
20110321_PB_01_sbDecAdd_Code
20110321_PB_02_sbDecAdd_Code
20110321_PB_03_sbDecAdd_Code
Sulprobil   Get it done   Contact   Disclaimer   Download