Loading editor...

Binary representations of integers

Four representation types are illustrated here: uint, two's complement, one's complement and biased representation.

Shorthand Meaning
uint Unsigned integer
2C Two's complement
1C One's complement
bias Biased binary representation

A binary representation can be seen as a mapping from n bits to a decimal number:

Encoding Weights Bias
uint
2C
1C
biased

Representation:

Change the bit values and bias in the widget below to see how it changes the representation of numbers:

+ + - =


Unsigned integer

This is the simplest representation.

  • Range: , so for
  • Every bit pattern maps to a different number
  • The lexicographic ordering of bit strings is the same as numeric order:

Lexicographical ordering of bit strings vs their numeric values

bits uint 2C 1C bias ()
  • Color coding: smallest to largest