User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
0 digits Decimal: โ€”
0 digits Decimal: โ€”
Quick presets:
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Negabinary (base โˆ’2) is a non-standard positional numeral system that represents every integer - positive, negative, and zero - without a sign symbol. This property makes it relevant in certain digital circuit designs and theoretical computer science. A miscalculation in radix conversion propagates through every downstream operation: arithmetic, checksums, protocol encoding. This tool converts between standard binary (base 2) and negabinary (base โˆ’2) using exact BigInt arithmetic, eliminating overflow errors that occur with naive 32-bit implementations. An intermediate decimal value is shown so you can verify each conversion step independently.

The conversion algorithm follows the Schroeppel method for negative-base encoding: repeated division by โˆ’2 with remainder correction. Note: both binary and negabinary use only digits 0 and 1, so the string representation alone cannot tell you which system it belongs to - context is everything. The tool assumes unsigned binary input (no two's complement). Pro tip: negabinary addition requires a specialized carry rule where a carry of 1 into position k produces โˆ’1 at position k+1, not +1.

binary negabinary base conversion number systems base -2 radix converter math tool

Formulas

In standard binary (base 2), a digit string dndnโˆ’1โ€ฆd0 represents the value:

N = nโˆ‘i=0 di โ‹… 2i

In negabinary (base โˆ’2), the same digit string uses a negative base:

N = nโˆ‘i=0 di โ‹… (โˆ’2)i

To convert a decimal integer N to negabinary, apply the Schroeppel division algorithm:

{
r = N mod 2N = (N โˆ’ r) รท (โˆ’2)

The remainder r is always forced to 0 or 1. When the standard modulo yields a negative remainder, add 2 to r and increment the quotient by 1. Digits are collected from least significant to most significant. The process terminates when N = 0.

Where: N = decimal integer value, di = digit at position i (either 0 or 1), r = remainder after division, i = bit position index (starting from 0).

Reference Data

DecimalBinary (base 2)Negabinary (base โˆ’2)Positional Weights (base โˆ’2)
0000
1111
2101104 + (โˆ’2) + 0
3111114 + (โˆ’2) + 1
41001004
51011014 + 0 + 1
61101101016 + (โˆ’8) + 0 + (โˆ’2) + 0
71111101116 + (โˆ’8) + 0 + (โˆ’2) + 1
810001100016 + (โˆ’8)
910011100116 + (โˆ’8) + 1
1010101111016 + (โˆ’8) + 4 + (โˆ’2)
โˆ’1N/A (unsigned)11(โˆ’2) + 1
โˆ’2N/A (unsigned)10โˆ’2
โˆ’3N/A (unsigned)1101(โˆ’8) + 4 + 0 + 1
โˆ’4N/A (unsigned)1100(โˆ’8) + 4
โˆ’5N/A (unsigned)1111(โˆ’8) + 4 + (โˆ’2) + 1
โˆ’6N/A (unsigned)1110(โˆ’8) + 4 + (โˆ’2)
โˆ’10N/A (unsigned)1011016 + 0 + 4 + (โˆ’2) + 0
1511111000116 + 0 + 0 + 0 + 1
16100001000016
20101001010016 + 0 + 4
32100000110000064 + (โˆ’32)
42101010111011064 + (โˆ’32) + 16 + 0 + 4 + (โˆ’2) + 0
1001100100110100100256 + (โˆ’128) + 0 + 32 + 0 + 0 + 4 + 0 + 0
25511111111100000011256 + 0 + โ€ฆ + (โˆ’2) + 1

Frequently Asked Questions

In base โˆ’2, odd-positioned bits carry negative positional weights (โˆ’2, โˆ’8, โˆ’32, โ€ฆ). By combining positive-weight and negative-weight positions, every integer - positive, negative, or zero - has a unique unsigned representation. No separate sign bit or two's complement encoding is needed.
Yes. For example, the string 110 in binary (base 2) equals 4 + 2 = 6, but in negabinary (base โˆ’2) it equals 4 + (โˆ’2) + 0 = 2. The digits are identical; only the positional weights differ. Context determines interpretation.
The maximum is the sum of all positive-weight positions set to 1. For even bit count n, this equals (2^n โˆ’ 1) / 3 rounded appropriately. In general, the range for n digits spans from (โˆ’2^n + 1) / 3 to (2^n โˆ’ 1) / 3 approximately. The exact bounds depend on parity of n.
Addition in negabinary uses a non-standard carry rule. A carry of 1 into column k effectively subtracts 2 from that column's contribution (because the base is โˆ’2). This means a carry generates a +1 carry into position k+1, which then has the opposite sign weight. Dedicated carry-propagation logic is required; standard binary adders produce incorrect results.
Yes. The tool uses JavaScript BigInt internally, so there is no 32-bit or 64-bit overflow limit. You can input binary strings hundreds of digits long and receive exact negabinary output. Performance remains interactive for inputs up to several thousand digits.
Negabinary eliminates the need for separate subtraction circuits in certain ALU designs because subtraction is inherently embedded in the positional weights. Historical implementations include the Polish BINEG computer (1950s). Modern use is rare but it remains a subject in coding theory and balanced number system research.