Questions tagged [binary]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
47 views

Binary range identification in terms of subset

Given a range of "K" bit numbers, we want to identify the whole range by using a subset within that range, with the following criteria - If there are > "n" consecutive 0s, it ...
Dave's user avatar
  • 23
0 votes
1 answer
35 views

Absolute difference between largest IEEE754 number and its predecesor

In simple precision format, the largest possible positive number is $A = 0 ~~~ 11111110 ~~~ 111\ldots 111$ Its predecessor is $B = 0 ~~~ 11111110 ~~~ 111 \ldots 110$ But what is the absolute ...
lafinur's user avatar
  • 181
0 votes
0 answers
22 views

Binary Comparison Between Two Integers

Say I have two integers,i and j, which for the sake of example will be 2 and 5, represented by $010_2$ and $101_2$ respectively. I have a third bit set to 0. If $j \geq i$, then this bit should change ...
MrStealYourFrog's user avatar
0 votes
1 answer
29 views

Classifying vectors that only contains 1001110101 numbers - Is Support Vector Machine the solution?

Assume that you are given a vector 0b1101001001011001 etc. And you are going to classify it. One can use Support Vector Machine, but is that method good for ...
euraad's user avatar
  • 97
0 votes
1 answer
65 views

How do I multiply 2 signed 4 bit numbers in a logic circuit?

I've been experimenting with making a binary calculator lately, and I've got the addition and subtraction working. I now want to start making a multiplier, but I have no idea where to even start. I ...
Tetie's user avatar
  • 103
0 votes
2 answers
85 views

Why is 2's complement used for representing negative numbers?

So I was reading the use complement operation in the digital logic and found, it is used to give additive inverse of the number and subtracting a number (like we do) is difficult for computer. So it ...
tbhaxor's user avatar
  • 128
0 votes
2 answers
54 views

1's and 2's complement of 0

In the Morris Mano's book on Digital Circuits Edition 3, it is defined that r's complement for N=0 is 0 and r-1 complement is not even defined. But lets say r = base = 2 Then 2'd complement of 0, ...
tbhaxor's user avatar
  • 128
0 votes
0 answers
40 views

Binary combinatorics with rank

I am looking at finding acceptable binary values with maximum 2 consecutive 1s and 0s, from a range of maximum 6 bits (2^6 values). Also, I want to rank and unrank these subset of values (in ...
Dave's user avatar
  • 23
0 votes
0 answers
27 views

DFA for "K" bit value with max "n" consecutive "0"s and "1"s

I had posted earlier a question regarding ranking max "n" consecutive "0"s and "1"s in a "K"-bit string - Order in a subset I got clarification regarding how ...
Dave's user avatar
  • 23
0 votes
2 answers
126 views

How do you convert this x86 assembly program to binary

I'm trying to convert a x86 assembly language program to binary. I have read a 1979 Intel 8086 manual and so understand the basic architecture, however I am still unsure as to how to convert this. ...
Hannah's user avatar
  • 1
1 vote
1 answer
64 views

Order in a subset

Lets consider a range of "K" binary digit numbers. In that range, we want to take a subset of those values which have (<="n" consecutive 0s) AND (<="n" consecutive ...
Dave's user avatar
  • 23
0 votes
0 answers
34 views

Exact Definition of simple bit pattern?

I didn't find an exact description for this, but I know that any integer type is a simple bit pattern, it seems to me that the simple bit pattern should have a more exact description as I understand ...
user502233's user avatar
1 vote
2 answers
125 views

How does Decimal to Binary conversion algorithm work?

I'm reading a book which says that to transform a number from decimal representation to binary representation you have to follow these steps: Take the integer part (the one before the point) of the ...
ela's user avatar
  • 305
0 votes
1 answer
57 views

ASCII invariant string for base64 Encoding

I know the basics about base64 encoding, but thinking about it abstractly I have a theoretical question. If we consider base64 a mathematical function(in our case computable), Does there exists an ...
Jayendra Parmar's user avatar
-2 votes
1 answer
58 views

How a computer works?

I know that a computer can be mechanical, screws/nuts or even water/pipes. Of course, it would be slow and big, but it doesn't have to be electric, transistors, etc. How can a machine like this do all ...
user157635's user avatar
1 vote
2 answers
66 views

Difficulty Understanding a Quick Method for Finding the Two's Complement of a Binary Number

This is more for my curiosity than anything else as I understand how to find the two's complement of a binary number via the standard approach which is to convert all 0s to 1s and 1s to 0s and then ...
Sebastian Szymczyk's user avatar
0 votes
1 answer
49 views

How executable binary can be signed?

Some devices (for example Android devices) are "locked", the bootloader checks following bootloader/software sign, right? Chain of trust. Signing technically means that the file must be ...
anony33258's user avatar
0 votes
1 answer
70 views

Within the set of signed integers representable by a bit string of length n, are any two elements equivalent to each other mod 2^n?

Donald Knuth's The Art of Computer Programming, Volume 1 Fascicle 1 contains the following exercise: If $\alpha$ is any string of 0s and 1s, let $\operatorname{s}(\alpha)$ and $\operatorname{u}(\...
Nick's user avatar
  • 101
1 vote
1 answer
60 views

Binary subsets for a given set

Lets take an example of the range of N=32 bits ...
Dave's user avatar
  • 23
0 votes
0 answers
49 views

Encoding and Decoding

I am trying to find an encoding function e:{0,1}^20→{0,1}^10 and a decoding function d:{0,1}^10→{0,1}^20. Goal is to find d and e so that maxBdH(d(e(B)),B) is as small as possible. Here, dH denotes ...
Ahsan Ali's user avatar
0 votes
4 answers
86 views

I need to test the speed of performing arithmetic operations on binary numbers

As part of a college project, I need to compare the speed of arithmetic operations directly in binary on different processors. Example: At what speed will binary addition be performed on an Intel Core ...
Kamil Pietrzak 'Moneta''s user avatar
0 votes
2 answers
173 views

File conversion to binary format to save storage space

Our test log files are stored in .asc format. Each file contains around 5000 rows of these Logging Strings as shown in the image. I would like to reduce the size of these files.They are around 4-5 MBs ...
Sajeev Pillai's user avatar
0 votes
1 answer
202 views

How does a text file distinguish a letter and number in binary

In a text file you can write both the letter 'A' and number '65'. But obviously one of these data will be saved with different bits while the ASCII standard gives the letter 'A' the binary code for 65....
Murat Can's user avatar
1 vote
1 answer
45 views

Solving an ambiguity concerning unsigned and signed integers [duplicate]

I am taking a class in computer science and I am not sure about the following. When one transforms $247_{10}$ into its binary counterpart one gets $11110111_2$. However, the same binary number ...
user153448's user avatar
0 votes
1 answer
31 views

Decimal To Binary Conversion: Predicting Numbers With No Zeros

Just a fun puzzle that occurred to me. Given the function below which converts decimal integers to binary strings, is it possible to predict which decimal numbers will lead to binary strings with no ...
redgest's user avatar
0 votes
2 answers
67 views

Is solving Binary String Matching equivalent to Solving All type of string matching?

This might be an irritating, naive question, but please bear with me. If an algorithm/code solves the string matching problem for a binary string, does not it imply that the algo/code actually solves ...
Michael's user avatar
  • 291
0 votes
1 answer
117 views

Difference between two's complement and sign-and-magnitude

I'm just starting to learn about representing numbers in sign-and-magnitude and two's complement, and both as signed binary integers two's complement if representing a negative number I should invert ...
user1039203's user avatar
1 vote
1 answer
24 views

Decomposing large bit mult or exp into smaller bit operations

Imagine a machine that can only hold N-bit values (N-bit uint). The machine can also calculate the 2N-bit result of two operations: mult, exp. The 2N-bit result is stored across 2 N-bit values (high/...
1m1's user avatar
  • 11
2 votes
1 answer
270 views

Cost of increasing a binary counter with a starting value n times

Consider a k-bit binary counter and suppose that in the beginning the value of the i-th most significant bit is $b_i$ for each $i = 0, . . . , k − 1$. Let $b = b_0 + 2b_1 +· · · + 2^{k−1} b_{k−1}$. ...
SVMteamsTool's user avatar
1 vote
1 answer
224 views

How do I find the regular expression for- All binary numbers greater than 110011

I am trying to solve a problem set to practice for an exam. How can I approach questions like these ? Is there a way to verify solutions or is it just trial and error ?
Ash Rivers's user avatar
2 votes
3 answers
419 views

when is 2's complement used, or called into use in hardware

so when doing digital design, lets say building a calculator we only take the 2s complement of a negative number. 13+(-12)=1 001101 + 110100 = (1)000001 the 1 in parenthesis is overflow that "...
Magnio's user avatar
  • 21
0 votes
0 answers
35 views

how would i go about creating a base 10 to base 2 converter

I am trying to create a calculator in excel for use in Minecraft later and I was wondering if the was any way to create and how I would create a base 10 to base 2 converter with only logic gates. if ...
TheRealDestroyer's user avatar
1 vote
0 answers
32 views

Standard for representing a float scaled to a particular range?

TL;DR Is there a "standard" way to represent a float scaled to a particular range, such that we get maximum precision for the given bit depth, within that range? I'll start with my general ...
hazymat's user avatar
  • 111
0 votes
0 answers
485 views

8-bit binary to bcd converter Verilog

We have been given task to write a 8-bit binary to bcd converter Verilog code, using structural code NOT behavioural, is it possible to guide us how can we create 8-bit binary to bcd converter using ...
user147085's user avatar
0 votes
1 answer
168 views

How do I determine the time and space complexity of the following algorithm?

I need to compute the time and space complexity in Big O notation for this algorithm I constructed for binary multiplication. ...
Shreyash_Gupta's user avatar
0 votes
0 answers
86 views

temporal compression of binary data

I have a sequence of source files that are very similar (akin to frames in a video), and each file can be compressed by a codec independently, but there is no temporal compression. I want to further ...
chaohuang's user avatar
  • 101
0 votes
2 answers
61 views

Can you compare large numbers this way?

If you created two very large numbers represented by binary data (perhaps using sha512 with random input for each hash) could you determine what binary block is numerically larger by iterating over ...
Kladskull's user avatar
  • 103
1 vote
0 answers
80 views

From binary to unary and EXPTIME

I read in [Razborov, "An equivalence between...", p.248] that It is well recognized in Theoretical Computer Science that when we change the representation of integers from binary to unary, ...
Aldo's user avatar
  • 11
1 vote
1 answer
317 views

Prove every number in double precision 32-bit floating-point format can be represented in 64-bit format

Theorem: Prove every number in double precision 32-bit floating-point format can be represented in double precision 64-bit floating point-format. 64-bit format: Attempt: Let $ b = b_0 ,...,b_{31} $ ...
flamel12's user avatar
  • 233
1 vote
1 answer
109 views

How is Gene sequence files i.e FASTA files so compressible?

Why are Gene squencing file i.e FASTA files so compressible. It was stated on a site that few compression algorithms are capable of compressing these files to Gigabytes (from Terabytes). And is it ...
Akash's user avatar
  • 35
0 votes
1 answer
68 views

What are the chances of hash collision given large input and small hash?

I have an input of 128 bits (binary, 0s and 1s) and want to hash this input with 32 bit CRC. But I am not sure if collision rate is moderate or too high ? Is it 2^128/2^32 = 2^98. And does that ...
Akash's user avatar
  • 35
0 votes
2 answers
294 views

Can more compression be achieved when data is sorted (in ascending or descending order)?

Let's say I have a file which is exactly 1 MB in size. Contents of file are : 0001001000... upto 128 bytes (128 bytes per line in file). If I sort it in ascending or descending order (using notepad+...
Akash's user avatar
  • 35
0 votes
4 answers
162 views

Why does the BOM consist of two bytes instead of one for example in encoding utf-16

Why does the BOM consist of two bytes instead of one for example in encoding utf-16? Information about the order of bytes can be easily saved on just one byte. Is it because it would be good for the ...
Qwertyluk's user avatar
  • 111
0 votes
1 answer
34 views

Can possiblity of hash collision be "zero" when we hash same file in different formats?

Let's say I have a file A, which is any normal file (pdf, jpeg, mp3 etc.) Now I get the binary dump of file, say another file B{A}. And the hexdump of file say, file H{A}. Now I hash all the three ...
Akash's user avatar
  • 35
0 votes
1 answer
44 views

Which is faster "Sorting strings in ascending order" or "Counting the frequency of all strings "?

I have a binary file with lots of 128 bit strings: For Example Line 1. 1000101001000100001111001010..... Line 2. 011010010101001001010..... and many more. I want to sort them in ascending order, and ...
Akash's user avatar
  • 35
0 votes
1 answer
297 views

How to represent $x$ in hexadecimal form where $x=2^n$?

When a value $x$ is a power of $2$, that is, $x = 2^n$ for some nonnegative integer n, we can readily write $x$ in hexadecimal form by remembering that the binary representation of $x$ is simply $1$ ...
user8314628's user avatar
1 vote
0 answers
139 views

Is it possible to find length of sum of two binary numbers without calculating sum?

I'm doing an assignment where I need to multiply two 16 bit numbers and store result as an 16 bit integer array. a is binary with length of ...
trofchik's user avatar
1 vote
2 answers
69 views

Why is the time complexity of the Bit Manipulation solution to Binary Addition O(M + N)?

I am trying to understand why the time complexity of the Bit Manipulation solution (https://leetcode.com/problems/add-binary/solution/) to the Binary Addition problem is O(M + N), where M and N are ...
Henry Zhu's user avatar
  • 125
3 votes
1 answer
105 views

What is the nature of the two bits of data held in a computer memory cell?

I hope this question doesn't offend anyone. I start off by saying that I have and always had difficulty understand the language used in computer science so I have to interpret everything into the ...
Meta_Alchemy's user avatar
0 votes
2 answers
1k views

How come the set of all binary strings is uncountable?

Sorry for bumping this very old problem which already has answers on multiple SE sites, but I just cannot understand any of the answers. Let $\Sigma_{bool} = \{0, 1\}$. Then, $(\Sigma_{bool})^*$ is ...
Captain Trojan's user avatar