Negabinary Converter

In base −2, that's
1100000111110
2,026 in decimal — try −2,026 and watch it convert with no sign at all.
Total digits
13
Fraction digits
0
Repeating cycle
vs plain binary
13 vs 11
Whole part — divide by −2, keep the remainders
Fraction part — multiply by −2, peel off digits

The division trick: divide by −2 but always keep the remainder 0 or 1 — never −1. So −13 ÷ −2 is 7 remainder 1 (because −2 × 7 + 1 = −13), not 6 remainder −1. That single rule is what lets negative numbers fall out of the algorithm with no sign attached. Fractions here are a half-and-half world too: 0.5 is written 1.1 — one, plus negative-a-half.

Base −2 uses only the digits 0 and 1, but its place values alternate: 1, −2, 4, −8, 16… The astonishing result: every number, positive or negative, gets its own bit pattern. No minus sign exists — or is needed.

In decimal, that's
−3.5
1101.1 read in base −2 — negative, with never a sign in sight.
Whole part
−3
As a fraction
−7/2
Positive places add
+5
Negative places take
−8.5
The tug of war, place by place

Each digit's contribution — even places pull the value up, odd places drag it down. The final number is wherever the tug of war settles. Shown for up to 16 places.

The positional expansion, written out

A quick sign-reading trick: the leftmost 1 decides everything. If it sits in an even position (1, 4, 16, 64…), the number is positive; in an odd position (−2, −8, −32…), negative. The remaining digits can only tug the value around within that place's reach — never far enough to flip the sign.

Digits 0 and 1 with an optional fraction point. There's no minus sign to type — whether the value comes out negative is decided entirely by which places hold the 1s.

Result, in base −2
11000
Decimal check: 6 + 2 = 8.
First, in decimal
6
Second, in decimal
2
Result, in decimal
8
Result digits
5
Column by column, right to left

The full rulebook for a column sum s (digits plus incoming carry): if s is 0 or 1, write it, carry nothing. If s is 2 or 3, write s − 2 and carry −1. If s is −1, write 1 and carry +1. Subtraction never needs its own circuitry: since a left-shift multiplies by −2, the negation of B is simply B plus B-shifted — so A − B is just two additions. Hardware designers loved that.

Addition in negabinary is famous for its strange carries: 1 + 1 doesn't carry a 1 — it carries a −1, which can itself trigger a carry of +1 later. Watch it happen column by column.

Integers −16 through 16

Positive and negative numbers, shoulder to shoulder, not a sign among them.

Hover any entry to see how it's built.

What fits in k digits?

The representable range for each digit count — it lurches alternately downward and upward as each new place opens either negative or positive territory. Binary with a sign bit would be symmetric; negabinary is deliberately lopsided.

Every integer from −16 to 16, each with its own unsigned bit pattern. Notice how counting upward makes the patterns jump around — that lurching walk is the price of banishing the minus sign.

The details
Counting's strange walk

Take the 6-digit bit patterns in ordinary counting order — 000000, 000001, 000010… — and plot the value each one means in base −2. Binary would draw a straight ramp; negabinary draws this sawtooth, visiting positives and negatives in leaps.

Negative bases aren't a thought experiment — real computers were designed and shipped around base −2. Pick a topic for the story.