You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
how to convert a real number/or integer into fixed number of bits?
11 views (last 30 days)
Show older comments
Quantiziation
N=10; %number of bits
M=2^(N); %resolution
LSB=Asig/(M-1); % Asig: peak amplitude of signal
Sin4=round(sin3/LSB);
Qsin=dec2bin(Sin4,N);
how can I control the number of bits and how can I reserve the MSB 10nth bit to signed value only?
6 Comments
Rik
on 8 Apr 2023
Why would you say you can't do that already with this code?
And to use the first bit as sign bit, you can set N to 9 instead, retrieve the sign with the sign function, and use abs on your input.
James Tursa
on 8 Apr 2023
It's unclear to me what your ultimate goal is. Are you simply trying to scale some floating point numbers to 10-bit signed integers using 2's complement storage scheme? Or 1's complement storage scheme? Or ...?
Tarik
on 9 Apr 2023
I have a sinewave with amplitude Asig and frequency f that sampled at certain Fs. when I use this code it provide a 16 bits. I wanted to round the floating number to integer then quantize them. I am going to share the code soon
James Tursa
on 9 Apr 2023
@Tarik You didn't answer my question about what integer format you wanted as a result.
Tarik
on 16 Apr 2023
No, I am not trying to Are you simply trying to scale some floating point numbers to 10-bit signed integers using 2's complement storage scheme Or 1's complement storage scheme. I have s sinewave that has an amplitude that I smapled at certain frequency Fs,then I wanted to quantize this sampled amplitude in 10 bit scheme. when I use it as I showed in the code above. it is shows it correct but when I try it on the sinewave, it shows more than 10 bits
Walter Roberson
on 16 Apr 2023
There are three major ways to represent signed numbers:
- one bit is devoted to sign, the rest of the bits are the absolute value of the number; this is called Separate Sign
- to obtain the negative of a number, replace every bit with its logical negation. for example 0110 would become 1001. This is called One's Complement
- to obtain the negative of a number, replace every bit with its logical negation, and mathematically add 1 (discarding the overflow if the original was all 0 so the logical negation was all 1). This is called Two's Complement
Two's Complement has a number of nice behaviours and is the most common for representing integers (except possibly in process control and some real-time work). Separate Sign is the most common for representation of floating point numbers
You need to tell us which of these three you are using.
Accepted Answer
John D'Errico
on 8 Apr 2023
Edited: John D'Errico
on 8 Apr 2023
I'm confused, by a confusing question.
You want to convert a real number into a representation as a fixed number of bits, so convert to binary. And you want one of those bits to be a sign bit. No problem.
But then you ask how you can "control the number of bits". The fact is, you can only control so much. Beyond that, you need to accept the idea of an overflow, that some numbers are not representable in such a fixed number of bits.
For example, suppose you want to quantize numbers that lie in the interval [-1,1], in a fixed number of bits. You already know how to do that.
format long g
signal = rand(5,1)*2 - 1
signal = 5×1
0.131803347624512
-0.0926671836207726
-0.427786502874666
-0.78610639150876
0.36743082189984
% the number of bits, so 9 bits for the number itself, and a sign bit.
N = 10;
S = -sign(signal)
S = 5×1
-1
1
1
1
-1
B = dec2bin(round(abs(signal)*2^(N-1)),N-1)
B = 5×9 char array
'001000011'
'000101111'
'011011011'
'110010010'
'010111100'
I'll now build the representation itself as a composite of the two pieces of information.
Bsignal = [char((S(:)+1)/2+'0'),B]
Bsignal = 5×10 char array
'0001000011'
'1000101111'
'1011011011'
'1110010010'
'0010111100'
So if the first bit is a 0, then the number was positive. If that first bit was 1, then it was negative.
We can recover the original signal, but only a 10 bit approximation to it, by going in the reverse.
Dsignal = (Bsignal(:,2:end) - '0')*2.^(8:-1:0)'/2^9.*(1-2*(Bsignal(:,1)-'0'))
Dsignal = 5×1
0.130859375
-0.091796875
-0.427734375
-0.78515625
0.3671875
As you can see, it was highly quantized, so we lost a lot of information in the process. If I had made N a larger integer, then the approximation would be better.
But how can you control the number of bits? That part is trivial. You are the one who can choose the value of N. As long as N is no more than 52, you will have no problems. Beyond that point, a double precision number itself only carries 52 bits.
If it is overflor you are worried about, then yes. If you try the above process on a number that is greater than 1 or less than -1, then it will fail. It fails because the result is essentially an overflow. But that is an aspect of any number representation in a finite number of bits. If you want, you can use a floating point representation, where some of those bits get allocated to an exponent. But that costs you too, as now you start to lose precision.
You might want to read some of Cleve Moler's blogs about 1/2 precision numbers. I think I recall 1/4 precision too.
I'm not sure what you are confused about though. You seem to have the basic idea there.
2 Comments
Tarik
on 16 Apr 2023
thank you for the detailed asnwer. I got the basic idea , it is just when I use the fucntion dec2bin with fixed N=10 ,it shows a result that is 16 bits
N=9; %number of maximal bit
Asig=4.6;
M=2^(N-1); %resolution, MSB is reserved to the sign
LSB=Asig/(M-1);
Sin4=round(ysamp/LSB);
Qsin=dec2bin(Sin4,N)
the result are :
Qsin =
'0000000000011110'
'0000000000111100'
'0000000001011010'
'0000000001110101'
'0000000010010000'
'0000000010101000'
'0000000010111101'
'0000000011010000'
'0000000011100001'
'0000000011101101'
'0000000011110111'
'0000000011111101'
'0000000011111111'
'0000000011111110'
'0000000011111001'
'0000000011110000'
'0000000011100100'
'0000000011010101'
'0000000011000011'
'0000000010101110'
'0000000010010110'
'0000000001111100'
'0000000001100001'
'0000000001000100'
'0000000000100110'
'0000000000001000'
'1111111111101001'
'1111111111001011'
'1111111110101110'
'1111111110010010'
'1111111101110111'
'1111111101011110'
'1111111101001000'
'1111111100110100'
'1111111100100011'
'1111111100010110'
'1111111100001011'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000110'
'1111111100001101'
'1111111100011000'
'1111111100100111'
'1111111100111000'
'1111111101001101'
'1111111101100100'
'1111111101111101'
'1111111110011000'
'1111111110110100'
'1111111111010010'
'1111111111110000'
'0000000000001111'
'0000000000101101'
'0000000001001011'
'0000000001100111'
'0000000010000010'
'0000000010011100'
'0000000010110011'
'0000000011000111'
'0000000011011001'
'0000000011100111'
'0000000011110010'
'0000000011111010'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110101'
'0000000011101011'
'0000000011011101'
'0000000011001100'
'0000000010111001'
'0000000010100010'
'0000000010001010'
'0000000001101111'
'0000000001010011'
'0000000000110110'
'0000000000010111'
'1111111111111001'
'1111111111011011'
'1111111110111101'
'1111111110100000'
'1111111110000100'
'1111111101101011'
'1111111101010011'
'1111111100111110'
'1111111100101100'
'1111111100011100'
'1111111100010000'
'1111111100001000'
'1111111100000010'
'1111111100000001'
'1111111100000011'
'1111111100001001'
'1111111100010010'
'1111111100011111'
'1111111100101111'
'1111111101000010'
'1111111101011000'
'1111111101110000'
'1111111110001010'
'1111111110100110'
'1111111111000011'
'1111111111100001'
'1111111111111111'
'0000000000011110'
'0000000000111100'
'0000000001011001'
'0000000001110101'
'0000000010001111'
'0000000010100111'
'0000000010111101'
'0000000011010000'
'0000000011100000'
'0000000011101101'
'0000000011110111'
'0000000011111101'
'0000000011111111'
'0000000011111110'
'0000000011111001'
'0000000011110000'
'0000000011100100'
'0000000011010101'
'0000000011000011'
'0000000010101110'
'0000000010010111'
'0000000001111101'
'0000000001100010'
'0000000001000101'
'0000000000100111'
'0000000000001001'
'1111111111101010'
'1111111111001100'
'1111111110101111'
'1111111110010010'
'1111111101111000'
'1111111101011111'
'1111111101001000'
'1111111100110101'
'1111111100100100'
'1111111100010110'
'1111111100001100'
'1111111100000101'
'1111111100000001'
'1111111100000010'
'1111111100000110'
'1111111100001101'
'1111111100011000'
'1111111100100110'
'1111111100111000'
'1111111101001100'
'1111111101100011'
'1111111101111100'
'1111111110010111'
'1111111110110100'
'1111111111010001'
'1111111111110000'
'0000000000001110'
'0000000000101100'
'0000000001001010'
'0000000001100111'
'0000000010000010'
'0000000010011011'
'0000000010110010'
'0000000011000111'
'0000000011011000'
'0000000011100111'
'0000000011110010'
'0000000011111010'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110101'
'0000000011101011'
'0000000011011101'
'0000000011001101'
'0000000010111001'
'0000000010100011'
'0000000010001010'
'0000000001110000'
'0000000001010100'
'0000000000110110'
'0000000000011000'
'1111111111111010'
'1111111111011011'
'1111111110111101'
'1111111110100001'
'1111111110000101'
'1111111101101011'
'1111111101010100'
'1111111100111110'
'1111111100101100'
'1111111100011101'
'1111111100010000'
'1111111100001000'
'1111111100000011'
'1111111100000001'
'1111111100000011'
'1111111100001001'
'1111111100010010'
'1111111100011111'
'1111111100101111'
'1111111101000001'
'1111111101010111'
'1111111101101111'
'1111111110001001'
'1111111110100101'
'1111111111000010'
'1111111111100000'
'1111111111111110'
'0000000000011101'
'0000000000111011'
'0000000001011000'
'0000000001110100'
'0000000010001110'
'0000000010100111'
'0000000010111100'
'0000000011010000'
'0000000011100000'
'0000000011101101'
'0000000011110110'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111001'
'0000000011110001'
'0000000011100101'
'0000000011010110'
'0000000011000100'
'0000000010101111'
'0000000010010111'
'0000000001111110'
'0000000001100010'
'0000000001000110'
'0000000000101000'
'0000000000001001'
'1111111111101011'
'1111111111001101'
'1111111110101111'
'1111111110010011'
'1111111101111000'
'1111111101011111'
'1111111101001001'
'1111111100110101'
'1111111100100100'
'1111111100010110'
'1111111100001100'
'1111111100000101'
'1111111100000001'
'1111111100000010'
'1111111100000101'
'1111111100001101'
'1111111100011000'
'1111111100100110'
'1111111100110111'
'1111111101001100'
'1111111101100010'
'1111111101111100'
'1111111110010111'
'1111111110110011'
'1111111111010001'
'1111111111101111'
'0000000000001101'
'0000000000101100'
'0000000001001001'
'0000000001100110'
'0000000010000001'
'0000000010011010'
'0000000010110010'
'0000000011000110'
'0000000011011000'
'0000000011100111'
'0000000011110010'
'0000000011111010'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110101'
'0000000011101011'
'0000000011011110'
'0000000011001101'
'0000000010111010'
'0000000010100100'
'0000000010001011'
'0000000001110001'
'0000000001010100'
'0000000000110111'
'0000000000011001'
'1111111111111011'
'1111111111011100'
'1111111110111110'
'1111111110100001'
'1111111110000110'
'1111111101101100'
'1111111101010100'
'1111111100111111'
'1111111100101100'
'1111111100011101'
'1111111100010001'
'1111111100001000'
'1111111100000011'
'1111111100000001'
'1111111100000011'
'1111111100001001'
'1111111100010010'
'1111111100011110'
'1111111100101110'
'1111111101000001'
'1111111101010110'
'1111111101101110'
'1111111110001000'
'1111111110100100'
'1111111111000001'
'1111111111011111'
'1111111111111110'
'0000000000011100'
'0000000000111010'
'0000000001010111'
'0000000001110011'
'0000000010001110'
'0000000010100110'
'0000000010111100'
'0000000011001111'
'0000000011011111'
'0000000011101100'
'0000000011110110'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111001'
'0000000011110001'
'0000000011100101'
'0000000011010110'
'0000000011000100'
'0000000010101111'
'0000000010011000'
'0000000001111110'
'0000000001100011'
'0000000001000110'
'0000000000101001'
'0000000000001010'
'1111111111101100'
'1111111111001101'
'1111111110110000'
'1111111110010100'
'1111111101111001'
'1111111101100000'
'1111111101001001'
'1111111100110110'
'1111111100100100'
'1111111100010111'
'1111111100001100'
'1111111100000101'
'1111111100000001'
'1111111100000010'
'1111111100000101'
'1111111100001101'
'1111111100011000'
'1111111100100110'
'1111111100110111'
'1111111101001011'
'1111111101100010'
'1111111101111011'
'1111111110010110'
'1111111110110010'
'1111111111010000'
'1111111111101110'
'0000000000001101'
'0000000000101011'
'0000000001001001'
'0000000001100101'
'0000000010000000'
'0000000010011010'
'0000000010110001'
'0000000011000110'
'0000000011010111'
'0000000011100110'
'0000000011110010'
'0000000011111010'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110110'
'0000000011101100'
'0000000011011110'
'0000000011001110'
'0000000010111010'
'0000000010100100'
'0000000010001100'
'0000000001110001'
'0000000001010101'
'0000000000111000'
'0000000000011010'
'1111111111111011'
'1111111111011101'
'1111111110111111'
'1111111110100010'
'1111111110000110'
'1111111101101101'
'1111111101010101'
'1111111100111111'
'1111111100101101'
'1111111100011101'
'1111111100010001'
'1111111100001000'
'1111111100000011'
'1111111100000001'
'1111111100000011'
'1111111100001000'
'1111111100010010'
'1111111100011110'
'1111111100101110'
'1111111101000000'
'1111111101010110'
'1111111101101110'
'1111111110001000'
'1111111110100011'
'1111111111000001'
'1111111111011110'
'1111111111111101'
'0000000000011011'
'0000000000111001'
'0000000001010111'
'0000000001110011'
'0000000010001101'
'0000000010100101'
'0000000010111011'
'0000000011001111'
'0000000011011111'
'0000000011101100'
'0000000011110110'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111001'
'0000000011110001'
'0000000011100110'
'0000000011010111'
'0000000011000101'
'0000000010110000'
'0000000010011001'
'0000000001111111'
'0000000001100100'
'0000000001000111'
'0000000000101001'
'0000000000001011'
'1111111111101100'
'1111111111001110'
'1111111110110001'
'1111111110010100'
'1111111101111010'
'1111111101100001'
'1111111101001010'
'1111111100110110'
'1111111100100101'
'1111111100010111'
'1111111100001100'
'1111111100000101'
'1111111100000001'
'1111111100000001'
'1111111100000101'
'1111111100001100'
'1111111100010111'
'1111111100100101'
'1111111100110110'
'1111111101001011'
'1111111101100001'
'1111111101111010'
'1111111110010101'
'1111111110110001'
'1111111111001111'
'1111111111101101'
'0000000000001100'
'0000000000101010'
'0000000001001000'
'0000000001100100'
'0000000010000000'
'0000000010011001'
'0000000010110000'
'0000000011000101'
'0000000011010111'
'0000000011100110'
'0000000011110001'
'0000000011111001'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110110'
'0000000011101100'
'0000000011011111'
'0000000011001110'
'0000000010111011'
'0000000010100101'
'0000000010001100'
'0000000001110010'
'0000000001010110'
'0000000000111001'
'0000000000011011'
'1111111111111100'
'1111111111011110'
'1111111111000000'
'1111111110100011'
'1111111110000111'
'1111111101101101'
'1111111101010101'
'1111111101000000'
'1111111100101101'
'1111111100011110'
'1111111100010001'
'1111111100001000'
'1111111100000011'
'1111111100000001'
'1111111100000011'
'1111111100001000'
'1111111100010001'
'1111111100011110'
'1111111100101101'
'1111111101000000'
'1111111101010101'
'1111111101101101'
'1111111110000111'
'1111111110100011'
'1111111111000000'
'1111111111011110'
'1111111111111100'
'0000000000011011'
'0000000000111001'
'0000000001010110'
'0000000001110010'
'0000000010001100'
'0000000010100101'
'0000000010111011'
'0000000011001110'
'0000000011011111'
'0000000011101100'
'0000000011110110'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111001'
'0000000011110001'
'0000000011100110'
'0000000011010111'
'0000000011000101'
'0000000010110000'
'0000000010011001'
'0000000010000000'
'0000000001100100'
'0000000001001000'
'0000000000101010'
'0000000000001100'
'1111111111101101'
'1111111111001111'
'1111111110110001'
'1111111110010101'
'1111111101111010'
'1111111101100001'
'1111111101001011'
'1111111100110110'
'1111111100100101'
'1111111100010111'
'1111111100001100'
'1111111100000101'
'1111111100000001'
'1111111100000001'
'1111111100000101'
'1111111100001100'
'1111111100010111'
'1111111100100101'
'1111111100110110'
'1111111101001010'
'1111111101100001'
'1111111101111010'
'1111111110010100'
'1111111110110001'
'1111111111001110'
'1111111111101100'
'0000000000001011'
'0000000000101001'
'0000000001000111'
'0000000001100100'
'0000000001111111'
'0000000010011001'
'0000000010110000'
'0000000011000101'
'0000000011010111'
'0000000011100110'
'0000000011110001'
'0000000011111001'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110110'
'0000000011101100'
'0000000011011111'
'0000000011001111'
'0000000010111011'
'0000000010100101'
'0000000010001101'
'0000000001110011'
'0000000001010111'
'0000000000111001'
'0000000000011011'
'1111111111111101'
'1111111111011110'
'1111111111000001'
'1111111110100011'
'1111111110001000'
'1111111101101110'
'1111111101010110'
'1111111101000000'
'1111111100101110'
'1111111100011110'
'1111111100010010'
'1111111100001000'
'1111111100000011'
'1111111100000001'
'1111111100000011'
'1111111100001000'
'1111111100010001'
'1111111100011101'
'1111111100101101'
'1111111100111111'
'1111111101010101'
'1111111101101101'
'1111111110000110'
'1111111110100010'
'1111111110111111'
'1111111111011101'
'1111111111111011'
'0000000000011010'
'0000000000111000'
'0000000001010101'
'0000000001110001'
'0000000010001100'
'0000000010100100'
'0000000010111010'
'0000000011001110'
'0000000011011110'
'0000000011101100'
'0000000011110110'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111010'
'0000000011110010'
'0000000011100110'
'0000000011010111'
'0000000011000110'
'0000000010110001'
'0000000010011010'
'0000000010000000'
'0000000001100101'
'0000000001001001'
'0000000000101011'
'0000000000001101'
'1111111111101110'
'1111111111010000'
'1111111110110010'
'1111111110010110'
'1111111101111011'
'1111111101100010'
'1111111101001011'
'1111111100110111'
'1111111100100110'
'1111111100011000'
'1111111100001101'
'1111111100000101'
'1111111100000010'
'1111111100000001'
'1111111100000101'
'1111111100001100'
'1111111100010111'
'1111111100100100'
'1111111100110110'
'1111111101001001'
'1111111101100000'
'1111111101111001'
'1111111110010100'
'1111111110110000'
'1111111111001101'
'1111111111101100'
'0000000000001010'
'0000000000101001'
'0000000001000110'
'0000000001100011'
'0000000001111110'
'0000000010011000'
'0000000010101111'
'0000000011000100'
'0000000011010110'
'0000000011100101'
'0000000011110001'
'0000000011111001'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110110'
'0000000011101100'
'0000000011011111'
'0000000011001111'
'0000000010111100'
'0000000010100110'
'0000000010001110'
'0000000001110011'
'0000000001010111'
'0000000000111010'
'0000000000011100'
'1111111111111110'
'1111111111011111'
'1111111111000001'
'1111111110100100'
'1111111110001000'
'1111111101101110'
'1111111101010110'
'1111111101000001'
'1111111100101110'
'1111111100011110'
'1111111100010010'
'1111111100001001'
'1111111100000011'
'1111111100000001'
'1111111100000011'
'1111111100001000'
'1111111100010001'
'1111111100011101'
'1111111100101100'
'1111111100111111'
'1111111101010100'
'1111111101101100'
'1111111110000110'
'1111111110100001'
'1111111110111110'
'1111111111011100'
'1111111111111011'
'0000000000011001'
'0000000000110111'
'0000000001010100'
'0000000001110001'
'0000000010001011'
'0000000010100100'
'0000000010111010'
'0000000011001101'
'0000000011011110'
'0000000011101011'
'0000000011110101'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111010'
'0000000011110010'
'0000000011100111'
'0000000011011000'
'0000000011000110'
'0000000010110010'
'0000000010011010'
'0000000010000001'
'0000000001100110'
'0000000001001001'
'0000000000101100'
'0000000000001101'
'1111111111101111'
'1111111111010001'
'1111111110110011'
'1111111110010111'
'1111111101111100'
'1111111101100010'
'1111111101001100'
'1111111100110111'
'1111111100100110'
'1111111100011000'
'1111111100001101'
'1111111100000101'
'1111111100000010'
'1111111100000001'
'1111111100000101'
'1111111100001100'
'1111111100010110'
'1111111100100100'
'1111111100110101'
'1111111101001001'
'1111111101011111'
'1111111101111000'
'1111111110010011'
'1111111110101111'
'1111111111001101'
'1111111111101011'
'0000000000001001'
'0000000000101000'
'0000000001000110'
'0000000001100010'
'0000000001111110'
'0000000010010111'
'0000000010101111'
'0000000011000100'
'0000000011010110'
'0000000011100101'
'0000000011110001'
'0000000011111001'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110110'
'0000000011101101'
'0000000011100000'
'0000000011010000'
'0000000010111100'
'0000000010100111'
'0000000010001110'
'0000000001110100'
'0000000001011000'
'0000000000111011'
'0000000000011101'
'1111111111111110'
'1111111111100000'
'1111111111000010'
'1111111110100101'
'1111111110001001'
'1111111101101111'
'1111111101010111'
'1111111101000001'
'1111111100101111'
'1111111100011111'
'1111111100010010'
'1111111100001001'
'1111111100000011'
'1111111100000001'
'1111111100000011'
'1111111100001000'
'1111111100010000'
'1111111100011101'
'1111111100101100'
'1111111100111110'
'1111111101010100'
'1111111101101011'
'1111111110000101'
'1111111110100001'
'1111111110111101'
'1111111111011011'
'1111111111111010'
'0000000000011000'
'0000000000110110'
'0000000001010100'
'0000000001110000'
'0000000010001010'
'0000000010100011'
'0000000010111001'
'0000000011001101'
'0000000011011101'
'0000000011101011'
'0000000011110101'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111010'
'0000000011110010'
'0000000011100111'
'0000000011011000'
'0000000011000111'
'0000000010110010'
'0000000010011011'
'0000000010000010'
'0000000001100111'
'0000000001001010'
'0000000000101100'
'0000000000001110'
'1111111111110000'
'1111111111010001'
'1111111110110100'
'1111111110010111'
'1111111101111100'
'1111111101100011'
'1111111101001100'
'1111111100111000'
'1111111100100110'
'1111111100011000'
'1111111100001101'
'1111111100000110'
'1111111100000010'
'1111111100000001'
'1111111100000101'
'1111111100001100'
'1111111100010110'
'1111111100100100'
'1111111100110101'
'1111111101001000'
'1111111101011111'
'1111111101111000'
'1111111110010010'
'1111111110101111'
'1111111111001100'
'1111111111101010'
'0000000000001001'
'0000000000100111'
'0000000001000101'
'0000000001100010'
'0000000001111101'
'0000000010010111'
'0000000010101110'
'0000000011000011'
'0000000011010101'
'0000000011100100'
'0000000011110000'
'0000000011111001'
'0000000011111110'
'0000000011111111'
'0000000011111101'
'0000000011110111'
'0000000011101101'
'0000000011100000'
'0000000011010000'
'0000000010111101'
'0000000010100111'
'0000000010001111'
'0000000001110101'
'0000000001011001'
'0000000000111100'
'0000000000011110'
'1111111111111111'
'1111111111100001'
'1111111111000011'
'1111111110100110'
'1111111110001010'
'1111111101110000'
'1111111101011000'
'1111111101000010'
'1111111100101111'
'1111111100011111'
'1111111100010010'
'1111111100001001'
'1111111100000011'
'1111111100000001'
'1111111100000010'
'1111111100001000'
'1111111100010000'
'1111111100011100'
'1111111100101100'
'1111111100111110'
'1111111101010011'
'1111111101101011'
'1111111110000100'
'1111111110100000'
'1111111110111101'
'1111111111011011'
'1111111111111001'
'0000000000010111'
'0000000000110110'
'0000000001010011'
'0000000001101111'
'0000000010001010'
'0000000010100010'
'0000000010111001'
'0000000011001100'
'0000000011011101'
'0000000011101011'
'0000000011110101'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111010'
'0000000011110010'
'0000000011100111'
'0000000011011001'
'0000000011000111'
'0000000010110011'
'0000000010011100'
'0000000010000010'
'0000000001100111'
'0000000001001011'
'0000000000101101'
'0000000000001111'
'1111111111110000'
'1111111111010010'
'1111111110110100'
'1111111110011000'
'1111111101111101'
'1111111101100100'
'1111111101001101'
'1111111100111000'
'1111111100100111'
'1111111100011000'
'1111111100001101'
'1111111100000110'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001011'
'1111111100010110'
'1111111100100011'
'1111111100110100'
'1111111101001000'
'1111111101011110'
'1111111101110111'
'1111111110010010'
'1111111110101110'
'1111111111001011'
'1111111111101001'
'0000000000001000'
'0000000000100110'
'0000000001000100'
'0000000001100001'
'0000000001111100'
'0000000010010110'
'0000000010101110'
'0000000011000011'
'0000000011010101'
'0000000011100100'
'0000000011110000'
'0000000011111001'
'0000000011111110'
'0000000011111111'
'0000000011111101'
'0000000011110111'
'0000000011101101'
'0000000011100001'
'0000000011010000'
'0000000010111101'
'0000000010101000'
'0000000010010000'
'0000000001110101'
'0000000001011010'
'0000000000111100'
'0000000000011110'
'0000000000000000'
'1111111111100010'
'1111111111000100'
'1111111110100110'
'1111111110001011'
'1111111101110000'
'1111111101011000'
'1111111101000011'
'1111111100110000'
'1111111100011111'
'1111111100010011'
'1111111100001001'
'1111111100000011'
'1111111100000001'
'1111111100000010'
'1111111100000111'
'1111111100010000'
'1111111100011100'
'1111111100101011'
'1111111100111101'
'1111111101010010'
'1111111101101010'
'1111111110000100'
'1111111110011111'
'1111111110111100'
'1111111111011010'
'1111111111111000'
'0000000000010111'
'0000000000110101'
'0000000001010010'
'0000000001101110'
'0000000010001001'
'0000000010100010'
'0000000010111000'
'0000000011001100'
'0000000011011101'
'0000000011101010'
'0000000011110101'
'0000000011111100'
'0000000011111111'
'0000000011111110'
'0000000011111010'
'0000000011110011'
'0000000011101000'
'0000000011011001'
'0000000011001000'
'0000000010110011'
'0000000010011100'
'0000000010000011'
'0000000001101000'
'0000000001001100'
'0000000000101110'
'0000000000010000'
'1111111111110001'
'1111111111010011'
'1111111110110101'
'1111111110011001'
'1111111101111110'
'1111111101100100'
'1111111101001101'
'1111111100111001'
'1111111100100111'
'1111111100011001'
'1111111100001110'
'1111111100000110'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001011'
'1111111100010101'
'1111111100100011'
'1111111100110100'
'1111111101000111'
'1111111101011110'
'1111111101110110'
'1111111110010001'
'1111111110101101'
'1111111111001010'
'1111111111101001'
'0000000000000111'
'0000000000100101'
'0000000001000011'
'0000000001100000'
'0000000001111100'
'0000000010010101'
'0000000010101101'
'0000000011000010'
'0000000011010100'
'0000000011100100'
'0000000011110000'
'0000000011111000'
'0000000011111110'
'0000000011111111'
'0000000011111101'
'0000000011110111'
'0000000011101110'
'0000000011100001'
'0000000011010001'
'0000000010111110'
'0000000010101000'
'0000000010010000'
'0000000001110110'
'0000000001011010'
'0000000000111101'
'0000000000011111'
'0000000000000001'
'1111111111100010'
'1111111111000100'
'1111111110100111'
'1111111110001011'
'1111111101110001'
'1111111101011001'
'1111111101000011'
'1111111100110000'
'1111111100100000'
'1111111100010011'
'1111111100001001'
'1111111100000011'
'1111111100000001'
'1111111100000010'
'1111111100000111'
'1111111100010000'
'1111111100011100'
'1111111100101011'
'1111111100111101'
'1111111101010010'
'1111111101101001'
'1111111110000011'
'1111111110011110'
'1111111110111011'
'1111111111011001'
'1111111111110111'
'0000000000010110'
'0000000000110100'
'0000000001010001'
'0000000001101110'
'0000000010001000'
'0000000010100001'
'0000000010111000'
'0000000011001011'
'0000000011011100'
'0000000011101010'
'0000000011110100'
'0000000011111011'
'0000000011111111'
'0000000011111110'
'0000000011111010'
'0000000011110011'
'0000000011101000'
'0000000011011010'
'0000000011001000'
'0000000010110100'
'0000000010011101'
'0000000010000100'
'0000000001101001'
'0000000001001100'
'0000000000101111'
'0000000000010000'
'1111111111110010'
'1111111111010100'
'1111111110110110'
'1111111110011001'
'1111111101111110'
'1111111101100101'
'1111111101001110'
'1111111100111001'
'1111111100101000'
'1111111100011001'
'1111111100001110'
'1111111100000110'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001011'
'1111111100010101'
'1111111100100011'
'1111111100110011'
'1111111101000111'
'1111111101011101'
'1111111101110110'
'1111111110010000'
'1111111110101100'
'1111111111001010'
'1111111111101000'
'0000000000000110'
'0000000000100101'
'0000000001000011'
'0000000001011111'
'0000000001111011'
'0000000010010101'
'0000000010101100'
'0000000011000010'
'0000000011010100'
'0000000011100011'
'0000000011110000'
'0000000011111000'
'0000000011111101'
'0000000011111111'
'0000000011111101'
'0000000011110111'
'0000000011101110'
'0000000011100001'
'0000000011010001'
'0000000010111111'
'0000000010101001'
'0000000010010001'
'0000000001110111'
'0000000001011011'
'0000000000111110'
'0000000000100000'
'0000000000000010'
'1111111111100011'
'1111111111000101'
'1111111110101000'
'1111111110001100'
'1111111101110010'
'1111111101011001'
'1111111101000100'
'1111111100110000'
'1111111100100000'
'1111111100010011'
'1111111100001010'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000111'
'1111111100001111'
'1111111100011011'
'1111111100101010'
'1111111100111100'
'1111111101010001'
'1111111101101001'
'1111111110000010'
'1111111110011110'
'1111111110111010'
'1111111111011000'
'1111111111110111'
'0000000000010101'
'0000000000110011'
'0000000001010001'
'0000000001101101'
'0000000010001000'
'0000000010100001'
'0000000010110111'
'0000000011001011'
'0000000011011100'
'0000000011101010'
'0000000011110100'
'0000000011111011'
'0000000011111111'
'0000000011111110'
'0000000011111011'
'0000000011110011'
'0000000011101000'
'0000000011011010'
'0000000011001001'
'0000000010110100'
'0000000010011110'
'0000000010000100'
'0000000001101001'
'0000000001001101'
'0000000000101111'
'0000000000010001'
'1111111111110011'
'1111111111010100'
'1111111110110111'
'1111111110011010'
'1111111101111111'
'1111111101100110'
'1111111101001110'
'1111111100111010'
'1111111100101000'
'1111111100011001'
'1111111100001110'
'1111111100000110'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001011'
'1111111100010101'
'1111111100100010'
'1111111100110011'
'1111111101000110'
'1111111101011100'
'1111111101110101'
'1111111110001111'
'1111111110101100'
'1111111111001001'
'1111111111100111'
'0000000000000101'
'0000000000100100'
'0000000001000010'
'0000000001011111'
'0000000001111010'
'0000000010010100'
'0000000010101100'
'0000000011000001'
'0000000011010100'
'0000000011100011'
'0000000011101111'
'0000000011111000'
'0000000011111101'
'0000000011111111'
'0000000011111101'
'0000000011110111'
'0000000011101110'
'0000000011100010'
'0000000011010010'
'0000000010111111'
'0000000010101010'
'0000000010010010'
'0000000001111000'
'0000000001011100'
'0000000000111111'
'0000000000100001'
'0000000000000010'
'1111111111100100'
'1111111111000110'
'1111111110101001'
'1111111110001101'
'1111111101110010'
'1111111101011010'
'1111111101000100'
'1111111100110001'
'1111111100100001'
'1111111100010100'
'1111111100001010'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000111'
'1111111100001111'
'1111111100011011'
'1111111100101010'
'1111111100111100'
'1111111101010001'
'1111111101101000'
'1111111110000010'
'1111111110011101'
'1111111110111010'
'1111111111010111'
'1111111111110110'
'0000000000010100'
'0000000000110011'
'0000000001010000'
'0000000001101100'
'0000000010000111'
'0000000010100000'
'0000000010110111'
'0000000011001010'
'0000000011011100'
'0000000011101001'
'0000000011110100'
'0000000011111011'
'0000000011111111'
'0000000011111110'
'0000000011111011'
'0000000011110011'
'0000000011101000'
'0000000011011010'
'0000000011001001'
'0000000010110101'
'0000000010011110'
'0000000010000101'
'0000000001101010'
'0000000001001110'
'0000000000110000'
'0000000000010010'
'1111111111110011'
'1111111111010101'
'1111111110110111'
'1111111110011011'
'1111111110000000'
'1111111101100110'
'1111111101001111'
'1111111100111010'
'1111111100101001'
'1111111100011010'
'1111111100001110'
'1111111100000110'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001010'
'1111111100010100'
'1111111100100010'
'1111111100110010'
'1111111101000110'
'1111111101011100'
'1111111101110100'
'1111111110001111'
'1111111110101011'
'1111111111001000'
'1111111111100110'
'0000000000000101'
'0000000000100011'
'0000000001000001'
'0000000001011110'
'0000000001111010'
'0000000010010011'
'0000000010101011'
'0000000011000001'
'0000000011010011'
'0000000011100011'
'0000000011101111'
'0000000011111000'
'0000000011111101'
'0000000011111111'
'0000000011111101'
'0000000011111000'
'0000000011101110'
'0000000011100010'
'0000000011010010'
'0000000011000000'
'0000000010101010'
'0000000010010010'
'0000000001111000'
'0000000001011101'
'0000000000111111'
'0000000000100010'
'0000000000000011'
'1111111111100101'
'1111111111000111'
'1111111110101001'
'1111111110001101'
'1111111101110011'
'1111111101011011'
'1111111101000101'
'1111111100110001'
'1111111100100001'
'1111111100010100'
'1111111100001010'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000111'
'1111111100001111'
'1111111100011010'
'1111111100101001'
'1111111100111011'
'1111111101010000'
'1111111101100111'
'1111111110000001'
'1111111110011100'
'1111111110111001'
'1111111111010111'
'1111111111110101'
'0000000000010100'
'0000000000110010'
'0000000001001111'
'0000000001101100'
'0000000010000110'
'0000000010011111'
'0000000010110110'
'0000000011001010'
'0000000011011011'
'0000000011101001'
'0000000011110100'
'0000000011111011'
'0000000011111111'
'0000000011111111'
'0000000011111011'
'0000000011110100'
'0000000011101001'
'0000000011011011'
'0000000011001010'
'0000000010110101'
'0000000010011111'
'0000000010000110'
'0000000001101011'
'0000000001001111'
'0000000000110001'
'0000000000010011'
'1111111111110100'
'1111111111010110'
'1111111110111000'
'1111111110011100'
'1111111110000000'
'1111111101100111'
'1111111101010000'
'1111111100111011'
'1111111100101001'
'1111111100011010'
'1111111100001111'
'1111111100000111'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001010'
'1111111100010100'
'1111111100100001'
'1111111100110010'
'1111111101000101'
'1111111101011011'
'1111111101110100'
'1111111110001110'
'1111111110101010'
'1111111111000111'
'1111111111100101'
'0000000000000100'
'0000000000100010'
'0000000001000000'
'0000000001011101'
'0000000001111001'
'0000000010010011'
'0000000010101011'
'0000000011000000'
'0000000011010011'
'0000000011100010'
'0000000011101111'
'0000000011111000'
'0000000011111101'
'0000000011111111'
'0000000011111101'
'0000000011111000'
'0000000011101111'
'0000000011100010'
'0000000011010011'
'0000000011000000'
'0000000010101011'
'0000000010010011'
'0000000001111001'
'0000000001011101'
'0000000001000000'
'0000000000100010'
'0000000000000100'
'1111111111100101'
'1111111111000111'
'1111111110101010'
'1111111110001110'
'1111111101110100'
'1111111101011011'
'1111111101000101'
'1111111100110010'
'1111111100100001'
'1111111100010100'
'1111111100001010'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000111'
'1111111100001111'
'1111111100011010'
'1111111100101001'
'1111111100111011'
'1111111101010000'
'1111111101100111'
'1111111110000000'
'1111111110011100'
'1111111110111000'
'1111111111010110'
'1111111111110100'
'0000000000010011'
'0000000000110001'
'0000000001001111'
'0000000001101011'
'0000000010000110'
'0000000010011111'
'0000000010110101'
'0000000011001010'
'0000000011011011'
'0000000011101001'
'0000000011110100'
'0000000011111011'
'0000000011111111'
'0000000011111111'
'0000000011111011'
'0000000011110100'
'0000000011101001'
'0000000011011011'
'0000000011001010'
'0000000010110110'
'0000000010011111'
'0000000010000110'
'0000000001101100'
'0000000001001111'
'0000000000110010'
'0000000000010100'
'1111111111110101'
'1111111111010111'
'1111111110111001'
'1111111110011100'
'1111111110000001'
'1111111101100111'
'1111111101010000'
'1111111100111011'
'1111111100101001'
'1111111100011010'
'1111111100001111'
'1111111100000111'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001010'
'1111111100010100'
'1111111100100001'
'1111111100110001'
'1111111101000101'
'1111111101011011'
'1111111101110011'
'1111111110001101'
'1111111110101001'
'1111111111000111'
'1111111111100101'
'0000000000000011'
'0000000000100010'
'0000000000111111'
'0000000001011101'
'0000000001111000'
'0000000010010010'
'0000000010101010'
'0000000011000000'
'0000000011010010'
'0000000011100010'
'0000000011101110'
'0000000011111000'
'0000000011111101'
'0000000011111111'
'0000000011111101'
'0000000011111000'
'0000000011101111'
'0000000011100011'
'0000000011010011'
'0000000011000001'
'0000000010101011'
'0000000010010011'
'0000000001111010'
'0000000001011110'
'0000000001000001'
'0000000000100011'
'0000000000000101'
'1111111111100110'
'1111111111001000'
'1111111110101011'
'1111111110001111'
'1111111101110100'
'1111111101011100'
'1111111101000110'
'1111111100110010'
'1111111100100010'
'1111111100010100'
'1111111100001010'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000110'
'1111111100001110'
'1111111100011010'
'1111111100101001'
'1111111100111010'
'1111111101001111'
'1111111101100110'
'1111111110000000'
'1111111110011011'
'1111111110110111'
'1111111111010101'
'1111111111110011'
'0000000000010010'
'0000000000110000'
'0000000001001110'
'0000000001101010'
'0000000010000101'
'0000000010011110'
'0000000010110101'
'0000000011001001'
'0000000011011010'
'0000000011101000'
'0000000011110011'
'0000000011111011'
'0000000011111110'
'0000000011111111'
'0000000011111011'
'0000000011110100'
'0000000011101001'
'0000000011011100'
'0000000011001010'
'0000000010110111'
'0000000010100000'
'0000000010000111'
'0000000001101100'
'0000000001010000'
'0000000000110011'
'0000000000010100'
'1111111111110110'
'1111111111010111'
'1111111110111010'
'1111111110011101'
'1111111110000010'
'1111111101101000'
'1111111101010001'
'1111111100111100'
'1111111100101010'
'1111111100011011'
'1111111100001111'
'1111111100000111'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001010'
'1111111100010100'
'1111111100100001'
'1111111100110001'
'1111111101000100'
'1111111101011010'
'1111111101110010'
'1111111110001101'
'1111111110101001'
'1111111111000110'
'1111111111100100'
'0000000000000010'
'0000000000100001'
'0000000000111111'
'0000000001011100'
'0000000001111000'
'0000000010010010'
'0000000010101010'
'0000000010111111'
'0000000011010010'
'0000000011100010'
'0000000011101110'
'0000000011110111'
'0000000011111101'
'0000000011111111'
'0000000011111101'
'0000000011111000'
'0000000011101111'
'0000000011100011'
'0000000011010100'
'0000000011000001'
'0000000010101100'
'0000000010010100'
'0000000001111010'
'0000000001011111'
'0000000001000010'
'0000000000100100'
'0000000000000101'
'1111111111100111'
'1111111111001001'
'1111111110101100'
'1111111110001111'
'1111111101110101'
'1111111101011100'
'1111111101000110'
'1111111100110011'
'1111111100100010'
'1111111100010101'
'1111111100001011'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000110'
'1111111100001110'
'1111111100011001'
'1111111100101000'
'1111111100111010'
'1111111101001110'
'1111111101100110'
'1111111101111111'
'1111111110011010'
'1111111110110111'
'1111111111010100'
'1111111111110011'
'0000000000010001'
'0000000000101111'
'0000000001001101'
'0000000001101001'
'0000000010000100'
'0000000010011110'
'0000000010110100'
'0000000011001001'
'0000000011011010'
'0000000011101000'
'0000000011110011'
'0000000011111011'
'0000000011111110'
'0000000011111111'
'0000000011111011'
'0000000011110100'
'0000000011101010'
'0000000011011100'
'0000000011001011'
'0000000010110111'
'0000000010100001'
'0000000010001000'
'0000000001101101'
'0000000001010001'
'0000000000110011'
'0000000000010101'
'1111111111110111'
'1111111111011000'
'1111111110111010'
'1111111110011110'
'1111111110000010'
'1111111101101001'
'1111111101010001'
'1111111100111100'
'1111111100101010'
'1111111100011011'
'1111111100001111'
'1111111100000111'
'1111111100000010'
'1111111100000001'
'1111111100000100'
'1111111100001010'
'1111111100010011'
'1111111100100000'
'1111111100110000'
'1111111101000100'
'1111111101011001'
'1111111101110010'
'1111111110001100'
'1111111110101000'
'1111111111000101'
'1111111111100011'
'0000000000000010'
'0000000000100000'
'0000000000111110'
'0000000001011011'
'0000000001110111'
'0000000010010001'
'0000000010101001'
'0000000010111111'
'0000000011010001'
'0000000011100001'
'0000000011101110'
'0000000011110111'
'0000000011111101'
'0000000011111111'
'0000000011111101'
'0000000011111000'
'0000000011110000'
'0000000011100011'
'0000000011010100'
'0000000011000010'
'0000000010101100'
'0000000010010101'
'0000000001111011'
'0000000001011111'
'0000000001000011'
'0000000000100101'
'0000000000000110'
'1111111111101000'
'1111111111001010'
'1111111110101100'
'1111111110010000'
'1111111101110110'
'1111111101011101'
'1111111101000111'
'1111111100110011'
'1111111100100011'
'1111111100010101'
'1111111100001011'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000110'
'1111111100001110'
'1111111100011001'
'1111111100101000'
'1111111100111001'
'1111111101001110'
'1111111101100101'
'1111111101111110'
'1111111110011001'
'1111111110110110'
'1111111111010100'
'1111111111110010'
'0000000000010000'
'0000000000101111'
'0000000001001100'
'0000000001101001'
'0000000010000100'
'0000000010011101'
'0000000010110100'
'0000000011001000'
'0000000011011010'
'0000000011101000'
'0000000011110011'
'0000000011111010'
'0000000011111110'
'0000000011111111'
'0000000011111011'
'0000000011110100'
'0000000011101010'
'0000000011011100'
'0000000011001011'
'0000000010111000'
'0000000010100001'
'0000000010001000'
'0000000001101110'
'0000000001010001'
'0000000000110100'
'0000000000010110'
'1111111111110111'
'1111111111011001'
'1111111110111011'
'1111111110011110'
'1111111110000011'
'1111111101101001'
'1111111101010010'
'1111111100111101'
'1111111100101011'
'1111111100011100'
'1111111100010000'
'1111111100000111'
'1111111100000010'
'1111111100000001'
'1111111100000011'
'1111111100001001'
'1111111100010011'
'1111111100100000'
'1111111100110000'
'1111111101000011'
'1111111101011001'
'1111111101110001'
'1111111110001011'
'1111111110100111'
'1111111111000100'
'1111111111100010'
'0000000000000001'
'0000000000011111'
'0000000000111101'
'0000000001011010'
'0000000001110110'
'0000000010010000'
'0000000010101000'
'0000000010111110'
'0000000011010001'
'0000000011100001'
'0000000011101110'
'0000000011110111'
'0000000011111101'
'0000000011111111'
'0000000011111110'
'0000000011111000'
'0000000011110000'
'0000000011100100'
'0000000011010100'
'0000000011000010'
'0000000010101101'
'0000000010010101'
'0000000001111100'
'0000000001100000'
'0000000001000011'
'0000000000100101'
'0000000000000111'
'1111111111101001'
'1111111111001010'
'1111111110101101'
'1111111110010001'
'1111111101110110'
'1111111101011110'
'1111111101000111'
'1111111100110100'
'1111111100100011'
'1111111100010101'
'1111111100001011'
'1111111100000100'
'1111111100000001'
'1111111100000010'
'1111111100000110'
'1111111100001110'
'1111111100011001'
'1111111100100111'
'1111111100111001'
'1111111101001101'
'1111111101100100'
'1111111101111110'
'1111111110011001'
'1111111110110101'
'1111111111010011'
'1111111111110001'
'0000000000010000'
'0000000000101110'
'0000000001001100'
'0000000001101000'
'0000000010000011'
'0000000010011100'
'0000000010110011'
'0000000011001000'
'0000000011011001'
'0000000011101000'
'0000000011110011'
'0000000011111010'
'0000000011111110'
'0000000011111111'
'0000000011111100'
'0000000011110101'
'0000000011101010'
'0000000011011101'
'0000000011001100'
'0000000010111000'
'0000000010100010'
'0000000010001001'
'0000000001101110'
'0000000001010010'
'0000000000110101'
'0000000000010111'
'1111111111111000'
'1111111111011010'
'1111111110111100'
'1111111110011111'
'1111111110000100'
'1111111101101010'
'1111111101010010'
'1111111100111101'
'1111111100101011'
'1111111100011100'
'1111111100010000'
'1111111100000111'
'1111111100000010'
'1111111100000001'
'1111111100000011'
'1111111100001001'
'1111111100010011'
'1111111100011111'
'1111111100110000'
'1111111101000011'
'1111111101011000'
'1111111101110000'
'1111111110001011'
'1111111110100110'
'1111111111000100'
'1111111111100010'
'0000000000000000'
Walter Roberson
on 16 Apr 2023
Edited: Walter Roberson
on 2 May 2023
dec2bin(11/4, 10)
ans = '0000000010'
dec2bin(-11/4, 10)
ans = '1111111101'
dec2bin(-3, 10)
ans = '1111111101'
Since R2020a
D can include negative numbers. The function converts negative numbers using their two's complement binary values.
floor() is used on the values before conversion, so -11/4 would be treated as -3 . The two's complement of -3 is formed by taking the representation of 3, which is 11 with a number of 0's before it, and taking the opposite of every bit, so a bunch of 1's before a 00, then adding 1, so a bunch of 1's followed by 01 is the result.
dec2bin() does not remove leading 1's from a negative number -- if it did then you would not be able to distinguish between 11100 and 00000 .
You need to decide whether you are using Separate Sign, or One's Complement, or Two's Complement.
More Answers (0)
See Also
Categories
Find more on Discrete Multiresolution Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)