Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [binary]

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

1
vote
0answers
56 views

Adding a Binary Number n to Itself 2^n times

Say I wanted to add the binary number $n = 100100111$ to itself $2^{n}$ times. What would the time complexity of this set of operations be? Would it be $O(n2^{n})$, or $O(\log(n2^{n}))$, or something ...
0
votes
0answers
20 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
40 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
24 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
50 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
55 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$ ...
16
votes
5answers
3k 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
53 views
0
votes
1answer
37 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
29 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 ...
0
votes
0answers
8 views

Convert polynomial generator to binary form for crc [duplicate]

i have the polynomial generator x^3 + x To convert to binary and i am unsure of the steps to complete. Help on how to convert various polynomials to binary would be greatly appreciated and i do not ...
1
vote
2answers
76 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
51 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
68 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
15 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
20 views

IEEE-754 and machine numbers

I've been trying to wrap my head around machine numbers like the unit roundoff (u) and epsilon (e) in combination with the IEEE 754 standard. My textbook states some things that don't really make ...
0
votes
0answers
39 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 ...
2
votes
1answer
40 views

Two's complement general formula

In college, we've seen some general formulas to compute the decimal value a of a binary representation $a_{N-1} \dots a_2 a_1 a_0$ in two's complement, $N$ being the number of bits. For $a \ge 0$ we'...
14
votes
3answers
2k views

Shannon Entropy of 0.922, 3 Distinct Values

Given a string of values $AAAAAAAABC$, the Shannon Entropy in log base $2$ comes to $0.922$. From what I understand, in base $2$ the Shannon Entropy rounded up is the minimum number of bits ...
0
votes
1answer
27 views

Need help converting machine code

I would appreciate some help with this question. The 32 bit numbers below represent a MIPS instruction. identify the different fields and state which instruction it is. give the assembler source code ...
3
votes
2answers
38 views

How many unique counting functions there are for strings of N bits?

Let a counting function inc for inputs of N bits be defined as: ...
0
votes
1answer
92 views

Bytes from integer using bitwise operators

So I am extremely confused with using bitwise shifts used to extract the bytes from an integer. I find that if I do something like this... ...
2
votes
1answer
84 views

What exactly is a “binary file”?

I suspect this may be more of a concept / theory question, but, I haven't been able to wrap my brain around what exactly a binary file is. I've read links such as the below: https://en.wikipedia.org/...
5
votes
0answers
118 views

Partitioning through block moves to the end

Suppose we have a binary string $s$. We wish to partition this string in a series of $0$s followed by $1$s (alternatively: we wish to sort), using only one operation: moving three consecutive elements ...
2
votes
1answer
1k views

Confusion in 2's complement of 00000000

I'm solving the end of the chapter problems of Morris Mano's Digital Design (4th Edition, if that's relevant). In one of the problems, it is asked to simply find the 1's and 2's complement of 00000000....
0
votes
0answers
23 views

Is this the right way to convert a negative floating point number in binary using two's complement method?

I'm a cs student and i've just started learning about binary arithmetic.I have to do this homework assignement to get prepared for exams..I'm having some trouble figuring out how to convert a negative ...
2
votes
0answers
30 views

If 2's complement is the best way to represent numbers in computers, why worry about BCD and other binary codes?

I'm studying Digital Logic and Design. And in the first chapter, there's all this information about various binary codes. I did some searching on youtube and found this awesome video - https://www....
-1
votes
1answer
30 views

How can the binary OR function be computed by a MOD3 gate of constant fan-in?

I've been working on a problem and in order to prove the bigger picture, I need to understand how a binary OR function can be computed by a constant fan-in MOD3 gate. I would seem that the output ...
1
vote
1answer
64 views

what does “vector” mean in computer science?

I am trying to understand how computers work under the hood, and I came across following sentence. "Computer technology is based on electronic circuits able to process vectors of 0's and 1's. For ...
5
votes
1answer
114 views

Could a standardized ternary system be more efficient than the binary system? [duplicate]

Could a standardized ternary (base-3) system be more efficient than the binary (base-2) system? Binary is efficient for processing using logic gates, but can be bulky when using for file storage or ...
2
votes
2answers
151 views
0
votes
2answers
160 views

Fast searching through bitarray?

I've been thinking for some time but can't figure a way out. I have big bitarray i.e. 1000+ items of 10_000 bits strings, I'm searching them now linearly. (currently it is stored in one chunk of ...
2
votes
1answer
189 views

Binary code and Hamming distance

I'm learning about CRC and Hamming distance and I have three questions. Lets say we have binary code described by ($+$ refers to sum modulo $2$): \begin{alignat*}{1} a_1 &+ a_2 &+ a_3 &+ ...
5
votes
4answers
2k views

Why does the formula 2n + 1 find the child node in a binary heap?

I learned that when you have a binary heap represented as a vector / list / array with indicies [0, 1, 2, 3, 4, 5, 6, 7, 8, ...] the indicies of the children of element at index n can be found with $...
0
votes
1answer
314 views

Logic Circuits - Binary divisible by 16 [closed]

I have a question ...
0
votes
0answers
47 views

Avoiding overflow when comparing between 16-bit numbers

Let's say I have a 16-bit number system. and let $a, b$ a 16-bit numbers in this system. I know that the numbers I can represent in this system are between $−32,768$ and $32,767$. Let's say I want ...
3
votes
1answer
676 views

Computing Hamming Distance Between Binary Vectors

Consider the following problem: Input: We are given a set $S$ of $n$ binary vectors. A binary vector is of the form $(b_0, b_1, ... b_n)$, where $b_i \in \{0, 1\}$. Therefore, there are $n$ vectors ...
1
vote
1answer
38 views

Converting a 32-bit bit pattern into floating point number

In The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D. i have read something like that, Single precision or 32-bit floating point forms the floating point number,...
0
votes
1answer
369 views

Assembly language translation to machine code (process in “RAM”) [closed]

How does a assembler (at very basic level) work in translation of Assembly language to machine code ? Just want to know that what is happening in RAM ? [What my understanding is that when when I ...
1
vote
1answer
171 views

n-bit 2's Complement Conversion

I'm learning 2's complement conversion for positional number systems. For the most part I have only seen 2's complement for represented in 8-bits. I had a discussion with a friend who explained that ...
8
votes
4answers
5k views

How can I multiply a binary representation by ten using logic gates?

So I’m currently working on something and I have converted all decimal digits 0-9 into binary. But now I want to take say 6 in binary and increase its order of magnitude by base 10 (turning 6 into 60) ...
0
votes
0answers
121 views

As a number (base 10) approaches infinity, what would be longer? Represented in BCD or Base-2?

My professor asked this question in his lecture class and I can't figure out the answer. My guess is BCD because you can't use up all the numbers (10 to 15), so you eat up space?
1
vote
0answers
165 views

Most efficient way to calculate log base 2

I recently started learning stuff with bits and now while I was solving one problem, I started thinking what is the most efficient way to calculate $$\lfloor \log_{2}K\rfloor$$ What I started ...
2
votes
0answers
140 views

K-ary tree that wrapped around

I'm not sure the best way to name this problem, but basically I need to construct a complete $k$-ary tree for $k \geq 2$ which has this nice property as $k=1$ tree that we can create a ring out of it. ...