Search for a tool
Négabinary

Tool to convert numbers with negabinary. The Negabinary system allow to represent positive and negative numbers without bit sign in a binary format (0 and 1) using the base -2.

Results

Négabinary -

Tag(s) : Informatics, Mathematics

Share
Share
dCode and you

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Team dCode likes feedback and relevant comments; to get an answer give an email (not published). It is thanks to you that dCode has the best Négabinary tool. Thank you.

Négabinary

Sponsored ads

Negabinary to Decimal Converter



See also: Binary Code

Decimal to Negabinary Converter



See also: Base N Convert

Binary to Negabinary Converter



See also: Binary Code

Tool to convert numbers with negabinary. The Negabinary system allow to represent positive and negative numbers without bit sign in a binary format (0 and 1) using the base -2.

Answers to Questions

How to convert a decimal number into negabinary?

The numbers in the negabinary system are described by the formula:

$$ \sum_{i=0}^{n}b_{i}(-2)^{i} $$

With $ b $ a bit and $ i $ its rank in the inverted negabinary development (ordered from the end to the beginning).

To convert an integer, it is enough to make a division repeated by $ -2 $ and to concatenate the obtained remainders starting with the end.

Example: 12 (decimal) in negabinary is written 11100 (its successive remainders are 0,0,1,1,1 :

12 / -2 = -6remainder 0-6*-2 = 12
-6 / -2 = 3remainder 03*-2 = -6
3 / -2 = -1remainder 1-1*-2 = 2 and 2+1 = 3
-1 / -2 = 1remainder 11*-2=-2 and -2+1 = -1
1 / -2 = 0remainder 10*-2 = 0 and 0+1 = 1

How to convert a Negabinay number to Decimal?

Negabinary writing corresponds to a base $ -2 $ writing system.

Example: 110 (negabinary) is equivalent to 2 (base 10) $ 1 \times (-2)^2 + 1 \times (-2)^1 + 0 \times (-2)^0 = 2 $

How to recognize a positive or negative integer in negabinary?

In nega-binary, negative integers(with a minus sign in base 10) have an even number of bits, while the positive integers(with a plus sign in base 10) have an odd number of bits.

Source code

dCode retains ownership of the source code of the script Négabinary online. Except explicit open source licence (indicated Creative Commons / free), any algorithm, applet, snippet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in any informatic langauge (PHP, Java, C#, Python, Javascript, Matlab, etc.) which dCode owns rights will not be released for free. To download the online Négabinary script for offline use on PC, iPhone or Android, ask for price quote on contact page !

Questions / Comments

Team dCode likes feedback and relevant comments; to get an answer give an email (not published). It is thanks to you that dCode has the best Négabinary tool. Thank you.


Source : https://www.dcode.fr/negabinary-system
© 2019 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaches. dCode
Feedback