Questions tagged [binary]

For questions about representing numbers in base 2 or performing arithmetic on them.

Filter by
Sorted by
Tagged with
-1
votes
1answer
26 views

How does malware enter the computer and take control on a binary or machine code level?

Malware can enter a computer in various ways, but I would like to know how it is able to simply use 0's and 1's and machine code to take over a computer and how it can stay hidden from antivirus ...
0
votes
2answers
25 views

Binary subtraction with numbers in 2's complement

How can i perform binary subtraction of two numbers that are already in 2's complement? I have to subtract 01010011 from 10100110,both numbers are in 2's complement. I know that 10100110 is -90,and ...
1
vote
1answer
37 views

Does a megabyte represent (2^8)^1000000 bits in base2? Isn't that more than enough combinations to represent everything?

Every introductory CompSci resource I can find goes through how 8 bits are in a byte, etc. So a byte can store some 2^8 values in binary. Then when asking about four bytes, we can assume this is (2^8)^...
0
votes
0answers
22 views

CNF encoding of additions

I have $m$ equations of the following form: $$x_1+x_2+\cdots+x_n=s,$$ where each variable is either 1 or 0, and the total number of variables is $m\approx3{,}000$. So I’m thinking of modeling each ...
0
votes
1answer
25 views

XOR of three integers where each pair's XOR is the other integer

I have three positive integers, a, b, and c. I know that $a\oplus b\oplus c=0$, so I got that each pairwise xor has to be the other positive integer. $a\oplus b=c$, $b\oplus c=a$, and so on, but I can'...
1
vote
1answer
24 views

Where is the theory about “binary toggling games”?

Let us -- using parameters $M, N$ and $L$ -- create an ordered set of size $M$ of $N$-bit long vectors $V$ and initialize them randomly: $V_k[i] = b \sim Bin(n=1, p=0.5)\ \forall i \in \{0\ ..\ N-1\}...
1
vote
1answer
38 views

Binary to ASCII using logical operations

I am learning Computer Architecture from Introduction to Computing Systems (2nd Edition) and am stuck on this question. What operations can be used to convert the binary representation of 3 into ...
1
vote
1answer
21 views

binary representation of ip prefixes

How does an ip prefix 90.0.0.0/4 translate to 0101∗ in binary and 10.0.0.0/2 to ...
1
vote
1answer
37 views

Sums of $2^{-l}$ that add to 1

Consider the following problem: You are given a finite set of numbers $(l_k)_{k\in \{ 1, ..., n \}}$ such that $\sum_{k=1}^n2^{-l_k}<1$. Describe an algorithm to find a set $(l'_k)_{k\in \{ 1, .....
1
vote
1answer
31 views

Calculating direct sum of 2 binary numbers

If we have say,key=‘0110‘ and 𝑚=‘1100‘, how will 𝑚⊕key mod 2 be calculated and what will be the answer equal to?
1
vote
2answers
50 views

What needs led to the implementation of ASCII codes?

Prior to ASCII existing, we already had at least four number systems, namely Binary Decimal Octal Hexadecimal So what were the needs that lead to the ...
0
votes
1answer
37 views

Number of nodes of given height in binary heap

Show that there are at most $\lceil n/2^{h+1}\rceil$ nodes of height $h$ in any $n$-element binary heap. How can I show this? Or, how can I prove this?
1
vote
2answers
66 views

Name of binary encoding scheme for integer numbers

I once found on Wikipedia a nice technique for encoding $k \in (2^{n-1}, 2^n)$ uniformly distributed integer numbers with less then $\log_2n$ average bits/symbol, thanks to a simple to compute ...
0
votes
3answers
546 views

Why the 127 encodings of ASCII needed to be extended to 256?

As you all know the ASCII chart needed to be extended from 127 encoding to 256, I can't really see why. Some google expert on Coursera said "We needed that because of the foreign languages". I still ...
3
votes
3answers
170 views

What are some uses of the Thue-Morse sequence in computer science?

Note: I come from a mathematics background. The Thue-Morse sequence $t_n$ is a binary sequence that takes the value $0$ at the positive integer $n$ if the number of $1$s in its binary expansion is ...
1
vote
0answers
29 views

relationship between binary numbers and binomial heaps

I understand that a binomial heap can be represented as binary numbers according to the degree of each tree but what exactly is the relationship between inserting a new node into the binomial heap and ...
1
vote
1answer
37 views

Given a binary tree $t$, prove that $size(t) < 2^{h(t)}$

I was able to prove that $size(t) \leq 2^{h(t)} - 1$ for any binary tree $t$, however I wasn't able to do anything reasonable with this statement. I know it's a proof by induction and that the ...
0
votes
1answer
67 views

How much time (in hours) will it take to check if the number with 20 binary digits is the prime number?

How much time (in hours) will it take to check if the number with 20 binary digits is the prime number, in problem it's mentioned that for number with 10 digits it took 1 hour it's also said that the ...
1
vote
2answers
136 views

Converting IPV4 address into Binary

So given an IP address it is converted into binary via calculating the binary of all different segments and then joining them. For example, 12.32.18.01 converted into a binary it would amount to this ...
1
vote
1answer
42 views

Convert scientific notation decimal number to binary

I'm given the number: $$8.881784197001252 \cdot 10^{-16}$$ I know it is $2^{-50}$ but suppose I didn't know. I need to convert it to binary. One way is to apply the school taught algorithm on the ...
0
votes
2answers
365 views

Minimum number of bits to represent negative number

Minimum number of bits required to represent $(+32)_{base10}$ and $(-32)_{base10}$ in signed two's compliment form? My attempt: 32 = 0100000 ( 1st zero - sign bit as positive) So to represent +32 we ...
0
votes
2answers
35 views

Fundamental motivation behind the use of bits and binary representation

This is a naive question, but what makes binary representation special from a theoretical standpoint and from the standpoint of information theory? If for technical reasons building ternary computers ...
0
votes
2answers
66 views

How to convert 010111 to decimal using only odd numbered positions while still applying the correct positional exponent?

I am trying to understand what this question is asking in terms of conversion. I know how to convert binary to decimal and vice versa, but the method you need to use has me confused. I need to ...
1
vote
1answer
24 views

What's the least signifcant bit of a mantissa system?

If Mantissa is a 1-dot-M fixed-point number whose most significant bit is always 1 then, how is the least significant bit calculated? I know the least and most significant bit of the mantissa ...
5
votes
2answers
255 views

checking '<' for two binary numbers in a cnf-formula

I want to check whether a arbitrary binary number is less or equal to another binary number in a cnf-formula. I can already construct a formula, which is not in cnf: Lets say n and m are two-digit ...
0
votes
0answers
76 views

Binary to Decimal Algorithm Explanation

I came across some code today for converting binary to decimal, and I realised that I don't fully understand how it works. Here it is in Python: ...
2
votes
1answer
24 views

Why does going from 2's complement (in binary) to the positive value by completing to 1 then adding 1 work?

I'm studying Computer science and this has confused me for a long time since our professor didn't give any proof. When changing from 2's complement to the positive value, we can go in reverse (by ...
0
votes
4answers
135 views

Is decimal number 8 represented as 3 bits or 4 bits in computer?

I was told by my professor that "It takes c * ln(n) bits to store a number n, where ln() is base 2 and c is a constant." Thus, to store a number 8, we need ln(8) = 3 bits(I think const c can be ...
2
votes
1answer
32 views

Conversion from octal numerical system to binary numerical system

I know that in order to convert a numeral in base-8 to a numeral in base-2 I can write each octal digit as a binary word of 3 bits. I know that 2^3 = 8 that is exactly the dimension of the base of ...
1
vote
0answers
52 views

Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa [closed]

Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa in floating point notation or otherwise. We actually have to prove this is not possible. But why can't we if we have infinite ...
2
votes
1answer
268 views

Binary representation of 129 when using 8bits for two's complement?

I have this confusion regarding binary representation of decimal value 129 (or even 128). If 8 bits are used to represent numbers when doing the two's complement, then we know that '00000000' to '...
0
votes
1answer
24 views

For signed integers, why don't representative the smallest number as all zeros in binary, and the largest as all ones?

I'm reading up on bitwise operators, complements, and two's complements, and I'm wondering why the lower limit of a range (aka lowest negative number) isn't all zeroes in binary, and the upper limit ...
0
votes
1answer
309 views

How do the bits of a certain emoji code for all the colors?

I am watching an introductory course on computer science. At one part, it starts talking about unicode and how the bits 11111011000000010. He states that that codes for a laughing/crying face emoji. ...
3
votes
1answer
114 views

Is is possible to determine if a given number is xor combination of some numbers?

I have been given a number Y which is ($a$ xor $b$ xor $c$ xor $d$ xor $e$ ) of some numbers ($a$,$b$,$c$,$d$,$e$) and another no X. Now i have to determine if X is a xor combination of ($a$,$b$,$c$,$...
2
votes
1answer
20 views

What are the sufficient conditions for weighted binary code to be self compliementary?

I was going through binary codes and found out that if the weighted binary code is self complimentary then it's weights addition will be equal to 9. Is the converse true? If not then what are the ...
0
votes
0answers
71 views

How does normalised floating point binary work with two's complement?

I'm doing AQA a-level computer science, and the specification for which states that: Exam questions on floating point numbers will use a format in which both the normalised mantissa and exponent are ...
0
votes
2answers
139 views

Float number to binary

I would like to convert 0,347 and 0,9828 to binary, how can I do that? I know that sucessive multiplication by 2 can do this, but this method seems very painful and even ineffective since the size of ...
0
votes
0answers
33 views

Converting a decimal to IEEE754 32-bit binary number

Convert 0.625 to IEEE754 32-bit binary number. 0.625 x 2 = 1.250 0.250 x 2 = 0.500 0.500 x 2 = 1.000 So, ...
0
votes
1answer
95 views

Why isn't it necessary to store an integer part of significant in IEEE754 floating point notation?

We see that there is a sign, exponent, and mantissa part for the notation. But, there is no location for the significant bit. Why isn't it necessary to store an integer part of significant in IEEE754 ...
2
votes
1answer
64 views

Prove that the next multiple of 4 is obtained using the next formula

I was reading an assembly procedure that needed to align addresses on 4 bytes boundary for performance reasons so it has used the next statement that i formulated as a theorem to be proven. Let $s$ ...
17
votes
5answers
4k views

Signed and unsigned numbers

How would the ALU in a microprocessor differentiate between a signed number, -7 that is denoted by 1111 and an unsigned number 15, also denoted by 1111?
0
votes
1answer
80 views

How does operating system display decimal numbers which are stored as binary? [duplicate]

What kind of magic happen with bytes in memory?
0
votes
1answer
39 views

Storage in computers?

If i want to save something in a computer such as a number 1 that would be 001 but if i save 001 in a computer how would the computer know that 001 is 1. Should we first save the number 1 in memory ...
0
votes
0answers
40 views

Find maximal matching in tree in $O\left(\frac{n}{\log n}\right)$

As any tree can be described as a binary sequence ($i$-th bit is 0 if the edge goes down and 1 otherwise, every edge is travelled twice $-$ up and down, so such sequence's length is $2 |V| - 2$), any ...
3
votes
2answers
542 views

Why does little endian apply to numbers and not to text strings?

The Portable Executable file format is the format that Windows EXE files use. It is a binary format. Numbers are in little endian form. Thus, the following hex represents the decimal number 256, not ...
1
vote
1answer
378 views

Binary Floating Point Range/Precision for 4-bit Mantissa and 4-bit Exponent

I'm trying to understand binary floating point and using just a 4-bit mantissa and a 4-bit exponent (both 2s compliment) to keep things simple. As far as I can tell, the largest denary number I can ...
0
votes
1answer
32 views

How to transform a Infinite decimal of $\frac{23}{6}$ into binary?

How to transform a decimal of $\frac{23}{6}$ into binary? $\frac{23}{6}$ is equal to $3.83333\bar{33}$, where the digit $3$s are repeated forever. I do know how to translate finite decimal into ...
2
votes
4answers
232 views

Binary 2s Compliment Applied Twice Gives Original - How?

At the moment the maths behind binary 2s compliment seems like voodoo to me. If I take 0011 (+3) and "flip and add 1", I get 1101 (-3) If I apply the same process to 1101, ("flip and add 1"), I get ...
2
votes
0answers
29 views

How can I optimise a 8b10b encoding for maximum alignment?

Imagine you encode an 8 bit symbol as a 10 bit symbol that is sent sequentially over a wire. The goal at the receiver is to detect the byte boundary. Since there are 4 times more encoded symbols than ...
0
votes
0answers
98 views

Worst case lower bound of binary search

For the question below, it is asking to prove the lower bound on the worst case is log(n). I have no problem proving this and the solution makes 100% sense to me. However, there is a comment at the ...