User Tools

Site Tools


notes:cprog:spring2024:projects:dtr0

This is an old revision of the document!


DTR0

REPOSITORY STEPS

BUILD THE CODE

RUN THE PROGRAM

BACKGROUND

INTEGER VALUES

An integer is a number that has no fractional component, so 2, 6, -15, and 17356 are all considered integers, while 13½, -1/12, π, and 5.2 are not. For our use, we split integers into 2 categories, signed and unsigned. A signed integer is any whole number, negative or positive, while an unsigned integer is a strictly positive whole number (and zero).

REPRESENTATION: BASE 2 (BINARY)

Each of the data value types has an associated size, ranging from 1 byte (8 bits) to 32 byte (256 bits), so the length of the number in binary will be given based on the type. For example:

unsigned int:
4 bytes
0000000000000000000000000000000

unsigned half int:
2 bytes
0000000000000000

Whether or not the data type is signed changes how the first bit of the number interacts with the rest, in a signed number the first bit acts as a positive or negative sign For example:

signed half half int
1 Byte
Binary: 10000000
Decimal: -128
Binary: 00000000
Decimal: 0
 

For further information on how negative act in binary try looking here:

https://en.wikipedia.org/wiki/Two%27s_complement

Each place value in binary is worth double the previous

Ex:      1 1 1 1
Is worth 8 4 2 1

To convert a binary number to decimal, just add each place value Ex:

11010010
(1*128)+(1*64)+(0*32)+(1*16)+(0*8)+(0*4)+(1*2)+(0*1)
=210

REPRESENTATION: BASE 16 (HEXADECIMAL)

STORAGE: BITS AND BYTES

BITWISE LOGIC: AND

BITWISE LOGIC: OR

BITWISE LOGIC: XOR

BITWISE LOGIC: NOT

notes/cprog/spring2024/projects/dtr0.1707780478.txt.gz · Last modified: 2024/02/12 23:27 by cgrant9