{
  "schema_version": "1.0",
  "codex": "thecodex.expert/coding",
  "type": "concept",
  "slug": "foundations/binary-and-number-systems",
  "name": "Binary and Number Systems",
  "section": "CS Foundations",
  "canonical_definition": "A binary number system is a positional numeral system with a radix of 2, using only the digits 0 and 1, in which each digit position represents a successive power of 2 — the numeral system used by all digital computers because the two digits correspond directly to the two stable states (on/off) of the transistors from which computers are built.",
  "confidence": "high",
  "last_verified": "2026-06-01",
  "source_count": 5,
  "url": "https://thecodex.expert/coding/foundations/binary-and-number-systems/",
  "concept_relationship": {
    "requires_first": ["foundations/how-computers-work"],
    "enables": [
      "foundations/logic-gates",
      "concepts/data-types",
      "how-languages-work/type-systems",
      "foundations/encoding"
    ],
    "commonly_confused_with": [
      "floating-point error vs. integer overflow — distinct failure modes",
      "hexadecimal as a different number vs. different representation of the same number"
    ]
  },
  "key_concepts": [
    "bit",
    "byte",
    "binary",
    "hexadecimal",
    "octal",
    "decimal",
    "positional notation",
    "radix",
    "two's complement",
    "signed integer",
    "unsigned integer",
    "IEEE 754",
    "floating point",
    "overflow",
    "NaN",
    "bitwise operations"
  ],
  "commonly_confused": [
    "Floating-point error is not a bug — 0.1 + 0.2 ≠ 0.3 exactly is the correct IEEE 754 result",
    "Two's complement is not the only negative representation — sign-magnitude exists in older formats",
    "Hexadecimal is the same number written differently, not a different kind of number",
    "Integer overflow is not the same as floating-point rounding error"
  ],
  "integer_ranges": {
    "int8":  { "bits": 8,  "signed_range": [-128, 127],              "unsigned_range": [0, 255] },
    "int16": { "bits": 16, "signed_range": [-32768, 32767],          "unsigned_range": [0, 65535] },
    "int32": { "bits": 32, "signed_range": [-2147483648, 2147483647], "unsigned_range": [0, 4294967295] },
    "int64": { "bits": 64, "signed_range": [-9223372036854775808, 9223372036854775807], "unsigned_range": [0, 18446744073709551615] }
  },
  "sources": [
    {
      "num": 1,
      "citation": "IEEE Std 754-2019. IEEE Standard for Floating-Point Arithmetic. IEEE Computer Society, July 2019.",
      "tier": 1
    },
    {
      "num": 2,
      "citation": "Patterson, D. A. & Hennessy, J. L. (2020). Computer Organization and Design. 6th ed. Morgan Kaufmann.",
      "tier": 1
    },
    {
      "num": 3,
      "citation": "Tanenbaum, A. S. & Austin, T. (2012). Structured Computer Organization. 6th ed. Pearson Education.",
      "tier": 1
    },
    {
      "num": 4,
      "citation": "The Unicode Consortium. The Unicode Standard. Current version. unicode.org.",
      "tier": 1
    },
    {
      "num": 5,
      "citation": "ISO/IEC 9899:2018. Programming languages — C (ISO C17). International Organization for Standardization.",
      "tier": 1
    }
  ]
}
