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]

The tag has no usage guidance.

7
votes
9answers
3k views

Is it any good to use binary arithmetic in a C++ code like “C style”?

I like the fact that the C language lets you use binary arithmetic in an explicit way in your code, sometimes the use of the binary arithmetic can also give you a little edge in terms of performance; ...
4
votes
2answers
453 views

Understanding physical address

I'm reading this article, Low Level Programming of the Raspberry Pi in C, which explains how to access the raspberry pi on a low level. It states that the virtual gpio address is 0x7E200000. ...
11
votes
5answers
6k views

How do you debug a binary format?

I would like to be able to debug building a binary builder. Right now I am basically printing out the input data to the binary parser, and then going deep into the code and printing out the mapping of ...
2
votes
2answers
527 views

Why directly edit binary files?

This may be a naive question, but I wonder when and why (non-research) developers would directly edit a binary file. It seems like the only good reason to use one is to create a kludge when you need ...
9
votes
3answers
39k views

Is there something special about the number 65535?

2¹⁶-1 & 2⁵ = 2⁵ (or? obviously ?) A developer asked me today what is bitwise 65535 & 32 i.e. 2¹⁶-1 & 2⁵ = ? I thought at first spontaneously 32 but it seemed to easy whereupon I thought ...
1
vote
1answer
136 views

binary search vs search with data samples

As long as I remember at least in older versions of Cassandra database, search was implemented in following way - During startup several samples are collected from sorted table and when data is ...
4
votes
4answers
1k views

Binary data formats, how to make ensure you can read different format versions?

On our project we have this data format that we use to process and record data on. As of late our application changed so that many of the data formats parameters have become obsolete. Currently we ...
3
votes
1answer
244 views

What's the best approach for using Git for a project containing a largish binary database (4 GB, 4000 files)?

The codebase consists of 190 Fortran 95+ source files, and directory of binary coefficient files required for the use of the code. The binary directory contains about 4000 files, some of which are ...
3
votes
1answer
1k views

Best method for Pattern Matching on Binary String?

I need to search a long string of binary string data (couple of megabytes worth of binary digits) for patterns of binary digits. There are about 100 000 different patterns to search for. Each is a ...
-3
votes
2answers
316 views

Can I distribute binaries of my GPLv3 software? [closed]

I have licensed my software under GPLv3 and made it available on Github as an open source repository. Am I allowed(under GPLv3) to distribute binary releases of the application so it is easier to use ...
27
votes
3answers
3k views

Why aren't “fat binaries” more widely used for cross-platform applications?

As far as I know, so-called "fat binaries"--executable files that contain machine code for multiple systems--are only really used on Apple PCs, and even there it seems like they only used them because ...
4
votes
3answers
150 views

Restricted randomization of a binary vector

Suppose I have a binary vector of sample size N with each of the two possible values (e.g., 0 and 1 occurring equally often). For example, if N=10, the binary vector is: 0 0 0 0 0 1 1 1 1 1 Suppose ...
32
votes
3answers
12k views

Does storing plain text data take up less space than storing the equivalent message in binary?

As a web developer I have very little understanding of binary data. If I take the sentence "Hello world.", convert it to binary, and store it as binary in an SQL database, it seems like the 1s and ...
3
votes
2answers
140 views

Preferred way to put drawings into Git repo

In order to visualize some concepts in a Git repo for other developers, I want to put there some vector drawings. Of course they should not be binary. If minor changes occur, the file change should be ...
3
votes
0answers
74 views

Rounding floats after modf()

I am trying to make an effective modf() function that uses floats instead of doubles. An embedded application I am working on only supports the float type. My modf() function works as expected with ...
0
votes
4answers
342 views

Shortening a boolean AND with third operand

I'm trying to calculate the sum of 2 bits using basic binary arithmetic and currently, I'm doing this: function Add(bool a, bool b, bool carry) { return { Result: a ^ b ^ carry, ...
1
vote
3answers
282 views

Can you name this square root algorithm on an unsigned integer through the manipulation of the binary number?

Apparently this algorithm is well known. The algorithm will build the square root answer bit by bit starting from the left-most bit to the last. Let's say we will support squaring up to a 8 bit ...
7
votes
4answers
1k views

Is it allowed to embed an LGPL command-line tool?

I want to sell a closed-application that depends upon a certain command line tool. Am I allowed to distribute my software including this command line tool? For example, as a separate binary ...
1
vote
1answer
144 views

How would a computer represent a negative base ten number in bits?

How would a computer represent -6886707 using 24 bits? I need someway to verify this: 100101101110101011001101. First I converted 6886707 to binary, which is 11010010001010100110011. Then I put one ...
-6
votes
1answer
78 views

In internal computer memory Char value ,string and integer how they differentiate time of storing and retrieving

In internal computer memory Char value ,string and integer how they differentiate time of storing and retrieving . Char A =ASCI value 127 Int value 127 Binary is same then how computer ...
0
votes
1answer
398 views

How to run 2-layer perceptron to solve XOR

XOR is not solvable by using a single perceptron with standard scalar product and unit step function. This article suggests using 3 perceptron to make a network: http://toritris.weebly.com/perceptron-...
1
vote
0answers
291 views

How are HTML files with binary headers interpreted? [closed]

I recently got an inexpensive phone with minimal browser support i.e. no javascript and on a small screen. Wanting to make the most of my device, I decided I would load some ebooks onto my device ...
42
votes
13answers
5k views

Is there an alternative to bits?

Is there an alternative to bits as the smallest unit of data? Something that won't be only 0 or 1, but actually hold many possible states in between? Wouldn't it be more natural to store floats like ...
1
vote
2answers
418 views

Different Number Base Systems

I am doing a summer assignment for AP Computer Science. For this I am learning about different number base systems and how to convert them. These topics led to me wondering about why programmers use ...
4
votes
2answers
2k views

Why do binary files load quicker than alphanumeric text files?

I've noticed that when I load/store large data files in a binary format, the program runs much faster than if I load data from an ASCII encoded file. Why is this the case? The data in my case is ...
3
votes
4answers
1k views

What separates text files from binary files, considering they are stored in binary?

There are text files and there are image, video, and music files. Why are image, video, and music files considered binary files, and why are text files not?
1
vote
2answers
2k views

What is a Relocatable Binary?

What is a Relocatable Binary? I tried doing some search on Google, but I am still confused. Also: what is the difference between an Executable and a Relocatable Binary?
21
votes
2answers
836 views

Optimize a git repo, containing large binary files

Our project is about 11GB, 10 of which are binary data (.png images). Consequently, a git diff or git status operations take up more than a minute. Fortunately all data files are separated into a ...
5
votes
1answer
7k views

Representing a number in 12 Bit 2's Complement Fixed Point

The original question is as follows: Consider a 12-bit two's complement fixed point representation, with 8 bits for the integer part and 4 bits for the fraction. What is the binary encoding of ...
2
votes
2answers
3k views

audio file processing in C++

I thought of the following project that I want to pursue: I want to create a C++ program, that can play audiofiles and visualize the amplitudes of individual frequency bands in real time (e.g. with ...
0
votes
0answers
237 views

Persisting and manipulating JS ArrayBuffer data on the server

My node.js app has to deal with (sometimes large; a few MB) tables of numerical data. I'm about to use JavaScript's native binary objects for this purpose (i.e. ArrayBuffer and friends), because they'...
2
votes
4answers
6k views

Understanding binary numbers in terms of real world objects [closed]

When I represent a number in the decimal system, I have an intuitive knowledge of what it amounts to. For example take the number '10': I understand that it means 10 apples or 10 people... i.e I can ...
28
votes
22answers
21k views

Why learn hexadecimal? [closed]

I've taken quite a few intro programming classes in my day, mostly just to get my feet wet in every different kind of programming I find. Not surprisingly, just about every class runs through the ...
16
votes
4answers
9k views

Why can't native machine code be easily decompiled?

With bytecode-based virtual machine languages like Java, VB.NET, C#, ActionScript 3.0, etc., you hear sometimes about how easy it is to just go download some decompiler off the Internet, run the ...
1
vote
1answer
90 views

Benefits of this data format

I'm integrating with a bluetooth blood pressure monitor, and I've come across one of the most bizarre data formats I've ever seen. The systolic, diastolic and pulse rate (all ints, should all be ...
0
votes
1answer
38 views

Generating New Media Content From Binary Patterns

At the most basic level, a digital media file (document, song, video, etc) is just a rather large pattern of 1's and 0's. We can say that for any given piece of digital media, there corresponds a ...
0
votes
3answers
295 views

Are hex dump and binary-to-text encoding related or different things?

Binary-to-text encoding is to represent binary data as characters. Hex dump of binary files seem also do the same for reading binary files. Are they related or different things?
4
votes
3answers
3k views

Data format for binary data transfer

I have to make an oscilloscope. Ideally, the oscilloscope connects to a probe. This probe should be another program, and could get the data locally or from a network. This data are numbers, floats and/...
0
votes
1answer
3k views

How to determine whether two trees (not necessarily binary) are isomorphic

Two ordered trees T' and T'' are said to be isomorphic if one of the following holds: ◦ both T' and T'' consist of a single node ◦ both T' and T'' have the same number k of subtrees, and the ith ...
0
votes
3answers
355 views

Does it really need to convert decimal,string, etc to binary?

I'm very new to programming. Just read some articles about algorithm for converting a decimal or string to binary. But,according to what I know, computers hold these data in binary form. So why don't ...
2
votes
0answers
538 views

Optimal data structure for binary data/Java

I have several input formats mostly restricted to geotiff and some proprietary binary formats. I import them into my program and then need to export them into various other data formats (also binary) ...
-1
votes
2answers
322 views

How were assemblers created straight from binary? [duplicate]

How did these earlier programmers know what combinations of binary produced certain results? Is there a way I can create an assembler from binary today?
2
votes
1answer
6k views

Bitwise operation on uppercase ASCII character turns to lowercase. Why?

I came across this in the http_parser library of node.js implementation. When I bitwise-OR an ASCII capitalized character code, it converts into its lowercase version. The lowercase version remains as ...
1
vote
2answers
2k views

When trying to find out if a number is even or odd: AND 1 or OR 0

I recently learned of the trick for finding out if a binary number is odd or even. If the last bit in the number is 0, then the number is even. If it ends in a 1, then the number is odd. In the ...
48
votes
3answers
65k views

Why is 2^16 a “special” number? [closed]

OK, I feel stupid asking this - but in Jeff's article: Getting the Interview Phone Screen Right and originally stated in the 5 essential phone screen questions: They shouldn't stare blankly at you ...
3
votes
1answer
381 views

Conveniently sorting and (binary?) searching an array of pairs of numbers?

So I have an array of distinct pairs of positive integers. That is, my array looks something like this (for instance): { (1,5) , (6,4), (5,3), (2,3), (2,4) } And my task is, for a given pair (a,b) ...
31
votes
3answers
61k views

What are binaries? [closed]

I see very often people using term binaries in different context. What are binaries? Collection on binary files, installation files, .dll files or what? Or is it just an general term for some ...
3
votes
1answer
7k views

Benefits of Java ByteArrayInputStream vs byte array?

I have a scenario where my Java process will be receiving a stream of binary data: public class DataHandler { public void handleData(DATA data) { // TODO: Do something with data } } ...
1
vote
1answer
115 views

Is it possible to modify a native executable and change (dynamic) library it depends on?

Say I compile a simple application called myproggy that depends on the libfoo dynamic library. Assuming I have another dynamic library libbaz that implements absolutely the same interface (in other ...
3
votes
1answer
855 views

How do you set and check a single bit in a programming language that does not support bitwise operations?

I'm using a programming language (more a scripting language) that does not support any bitwise operators like AND, OR, XOR, NOT (and shift as well). Common arithmetic and logical operations like + - *...