Questions tagged [binary]

Binary, the base-2 numeral system, represents numbers using two symbols: 0 and 1. For compiled computer programs, use the "executable" tag instead.

Binary is the base-2 positional numeral system. It represents numbers using two symbols: 0 and 1.

Computers use binary in digital circuitry using logic gates, where the symbols translate to states of off (0) and on (1).

Here are binary numbers corresponding to 0 to 10 in the decimal system:

Decimal   Binary
-------   ------
      0        0
      1        1
      2       10
      3       11
      4      100
      5      101
      6      110
      7      111
      8     1000
      9     1001
     10     1010

Other tags

14710 questions
4
votes
2 answers

What's a sensible way to represent a binary genome for a genetic algorithm?

My previous question belied my inexperience and was based on an assumption. Now I am much wiser. (Put 1s and 0s in a string? Pah! I laugh at the suggestion!) My question is then, how should I encode my genomes? On paper, they look like…
Tom Wright
  • 11,278
  • 15
  • 74
  • 148
4
votes
2 answers

create 3D binary image

I have a 2D array, a, comprising a set of 100 x,y,z coordinates: [[ 0.81 0.23 0.52] [ 0.63 0.45 0.13] ... [ 0.51 0.41 0.65]] I would like to create a 3D binary image, b, with 101 pixels in each of the x,y,z dimensions, of coordinates…
MyCarta
  • 808
  • 2
  • 12
  • 37
4
votes
3 answers

Why cant I do blob detection on this binary image

First, now i am doing the blob detection by Python2.7 with Opencv. What i want to do is to finish the blob detection after the color detection. i want to detect the red circles(marks), and to avoid other blob interference, i want to do color…
Nan Shi
  • 55
  • 1
  • 1
  • 6
4
votes
1 answer

Convert 8 bytes to a signed long (64 bit)

I'm reading 8 bytes from a socket in PHP, and want to transform them into a 64 bit signed integer. How can I do this in 64 bit PHP? unpack doesn't support 64 bit numbers In 32 bit PHP, is there a way to make it into a string that can be used by…
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
4
votes
0 answers

Including foreign shared library when running a binary with qemu

I have a foreign ARM binary I need to run with Qemu. It relies on an ncurses shared library, libncurses.so.5. I've tried running qemu-arm -L /usr/arm-linux-gnueabihf/ ./program Which complains that it can't find libncurses.so.5. I have the…
4
votes
2 answers

How can I get the function sinatures from a jar file?

In Eclipse or NetBeans, when you "control + click" into a function, you can at least see its entire signature, even if it's in a jar file. I am wonderging if it's possible to write a tool to pull out all the function signatures from a jar file. Is…
Winston Chen
  • 6,799
  • 12
  • 52
  • 81
4
votes
2 answers

How to create a textual binary representation of an image in JavaScript?

For a little project I would like to convert an image to a binary representation (zeroes and ones). As I want to use this on a machine that is not configured to run PHP, .NET, ... I would like to do this in JavaScript. At the moment I managed to…
Jules
  • 7,148
  • 6
  • 26
  • 50
4
votes
2 answers

SQL Server numeric format

When I do the following: DECLARE @x float SET @x = 1234.5 SELECT CONVERT(varbinary, @x) What is the returned format? I need to get the original number back from .net somehow, and I only have the binary value available. Clarification: The statement…
erikkallen
  • 33,800
  • 13
  • 85
  • 120
4
votes
5 answers

How do you call this binary data type, and how to handle it in C#?

Let's say we have a binary file that contains 2 bytes that form an integer, in reverse. So for example, the bytes show like this: (hexadecimal) EB 03 00 00 Which should be interpreted as this: 00 00 03 EB Which C# should be able to input as…
Codecat
  • 2,213
  • 3
  • 28
  • 39
4
votes
4 answers

C++ read and compare magic number from file

i have i file i want to read in C++. First thing i have to read and check is the magic number of the file. In my case it is the Hex-Value: 0xABCDEF00 I read and compare the number this way: ifstream input ("C:/Desktop/myfile", ios::binary); if…
Opa114
  • 518
  • 4
  • 12
  • 28
4
votes
1 answer

How do use a Crash Report from Apple in xCode?

I have received a Crash Report from Apple (joy). I understand I can symbolize this report in order to see what is crashing in my code. I understand I need the dSYM and build binary to do this. My question is what are the exact steps I need to follow…
GuybrushThreepwood
  • 5,598
  • 9
  • 55
  • 113
4
votes
1 answer

BASH - write HEX string to Binary file

I have a HEX string in my bash script like the following: 1B6C00001AD615 I want to write this string in a binary file. (the binary representation of this string in a file that can be read with any normal hex editor for example) I tried to use "bc"…
Panos
  • 7,227
  • 13
  • 60
  • 95
4
votes
1 answer

Whats the highest and the lowest integer for representing signed numbers in two's complement in 5 bits?

I understand how binary works and I can calculate binary to decimal, but I'm lost around signed numbers. I have found a calculator that does the conversion. But I'm not sure how to find the maximum and the minumum number or convert if a binary…
Nooblhu
  • 552
  • 15
  • 33
4
votes
3 answers

extract the last 2 bits in binary

The number 254 is 11111110 in binary. My problem is I want to grab the last 2 bits (10). I was told to use the % operator to do this but I don't know how. Can anyone help me with this problem?
dye
  • 49
  • 1
  • 2
4
votes
1 answer

Why does Javascript treat a number as a two's complement

Here is the explanation of why ~5 equals to -6 from here: 5 = 0000 0101 Flipped (~5) = 1111 1010 So, which number does 1111 1010 represent? Since the first digit is a 1 we know it's a negative value. To find which value,…
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
1 2 3
99
100