Data representations

MAT 594E

Andrés Cabrera

andres@mat.ucsb.edu

From mechanical calculators to computers

Neither a computer...

The first programmable computer was the Analytical Engine designed by Charles Babbage.

 

It combined the Jacquard Loom with Babbage's Difference Engine

 

 

Jacquard Loom and

punch cards

Difference Engine

A Computer

  • Stores states (data/computation)
  • Performs operations
  • Is programmable

The electronic computer

  • Essentially a miniaturization of the mechanical computer
  • Memory of states often stored indirectly (not as part of the "mechanism")

Memory

  • Faster is usually more expensive
  • Dynamic (can be changed unlike to punch cards)
  • Often fast memory is used for computation and larger small memory is used for long term storage
  • Memory paging
  • e.g. RAM (Random Access Memory)

Storage

  • Slow but large
  • Dynamic or static

Mercury Delay Lines

Acoustic Delay Lines

Magnetic Drum Memory

There are 10 types of people:

Those who understand binary and those who don't.

Binary

  • 0001 => 1
  • 0010 => 2
  • 0011 => 3
  • 0100 => 4
  • 0101 => 5

Bits and binary

  • In computing each binary digit is called a bit
  • 8 bits make up one byte
  • The number of possible combinations for N bits is 2^N
  • i.e. that is the maximum number of states or values that can be represented with those bits.

Boolean Algebra

001 AND 111 = 001

010 OR 110 = 110

NOT 011 = 100

Binary numbers

  • Just two digits
  • To represent all information
  • Easy to build circuitry to detect two states
  • (Harder to detect multiple states)
  • A bit is a "column" to store binary digits
  • Endianness refers to whether the first digit is the highest or lowest valued digit

Hexadecimal

  • Base 16
  • Digits from 0 to F
  • Each digit corresponds to 4 bits, 2 digits make a byte
  • Often used to represent bytes in a concise way

Encoding information

Binary encoding

Integers

  • Unsigned integers can map directly to base 2 numbers
  • Signed integers can be done in different ways
    • use 1 bit for sign
    • two's complement (the negative numbers count down from the maximum unsigned integer). Can result in more efficent basic calculations.

Programming statements

  • Assignments and Expressions
  • Conditional branching
  • Loops

Intro to Python

Data representations

By mantaraya36

Data representations

  • 1,246