Skip to main content

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
31 views

Confusion on 1 bit precession

We know binary representation of $\frac{1}{3}=0.010101..$. What will its 1 bits precession $0.0$ or 0.1? Note that $0.1=\frac{1}{2}$ is closer to $\frac{1}{3}$ than $0.0=0$.
Sanu's user avatar
  • 49
2 votes
1 answer
73 views

Conditional Maximization of a Binary Matrix

Given an $L \times N$ matrix $A$ with only binary values, $A_{ij} \in \{0, 1\}$, and a vector $b$ with $b_j = 2^{j-1}$, I want to find a matrix $\tilde{A}$ that maximizes $\tilde{c}=\tilde{A}b$, ...
Dan's user avatar
  • 61
-4 votes
1 answer
34 views

Binary subtraction using two's compliment

(22)10 - (65)10= (?)2 Perform this operation using 2's compliment method.Use 8bit representation of numbers
user169041's user avatar
0 votes
2 answers
50 views

A good way to hash two numbers with known properties together

I have two 64-bit numbers a and b which have a few properties: only 49 out of the 64 bits are used (15 bits are always 0), and ...
Rak Laptudirm's user avatar
0 votes
1 answer
37 views

What is the value range for absolute value formulation of binary variable

According to this link binary variables - absolute values the formula of some binary variables like absolute value is : y = | x1 - x2| for two variables x1, x2 with 0 ≤ xi ≤ U Introduce binary ...
SnoopyKid's user avatar
  • 101
0 votes
2 answers
63 views

why didn't ASCII/utf-8 used 00000000 to represent char 0 or rather any other character

I mean why value of 0 value in binary is not used by ascii encoding , it would have been used to represent char 0 or anything else why they used it to represent NULL
Shubham Atkal's user avatar
0 votes
3 answers
60 views

Is there an algorithm to implement N-input-gates using smaller gates?

To borrow part of a description from a similar but distinct question: there exist 2^(2^N) different functions which accept N binary inputs and return a 1 bit output. For the purposes of my question I ...
HappMacDonald's user avatar
1 vote
1 answer
101 views

Splitting a Larger Unsigned Integer into Summable Parts

I have a very strange (arbitrary) problem that I have been trying to wrap my head around, but have been struggling to figure out how to accomplish this. I'll use Rust but in a pseudo-code fashion, ...
Naftuli Kay's user avatar
1 vote
2 answers
121 views

Check if n-bit number is divisible by 7

Show how to check if n-bit number is divisible by 7 in logarithmic circuit depth. How can I construct the circuit to be able to check the divisibility?
popcorn's user avatar
  • 183
0 votes
0 answers
55 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
  • 25
0 votes
1 answer
45 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
  • 195
0 votes
0 answers
25 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
207 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
196 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
  • 208
0 votes
2 answers
82 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
  • 208
0 votes
0 answers
49 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
  • 25
0 votes
0 answers
47 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
  • 25
0 votes
2 answers
660 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
85 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
  • 25
0 votes
0 answers
40 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 ...
Gor Madatyan's user avatar
1 vote
2 answers
188 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
  • 315
0 votes
1 answer
79 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
65 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
148 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
69 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
71 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
71 views

Binary subsets for a given set

Lets take an example of the range of N=32 bits ...
Dave's user avatar
  • 25
0 votes
0 answers
53 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
157 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 'Moneta' Pietrzak's user avatar
0 votes
3 answers
406 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
300 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
65 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
33 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
80 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
147 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
361 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
260 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
555 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
41 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
36 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
548 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
197 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
94 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
98 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
85 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
363 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
121 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
82 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