Data Types
Main data types include: integer, real/float, boolean, character, and string
Primitive data type:
Casting data types
converting one data type to another.
Why is data stored in computers in a binary format?
Bit
binary digit that can have two values: 0 or 1.
Overflow Error
Hexadecimal
Sign and Magnitude
One’s Complement
ones complement method
Two’s complement
twos complement method
First number is a negative number. E.g 1110 would be -8 + 4 + 2 = -2.
Adding 1’s to the number front will not change the value.
To change from positive to negative, flip all the bits and add 1 (binary version so 0000 0001).
Positive numbers always start with a 0, while negative numbers always start with a 1.
fixed-point binary
normalisation
representing fractional numbers using floating-point binary method
e.g 4 bit mantissa and 4 bit exponent
split into mantissa and exponent, work out exponent
0111 0001
floating point always starts at 0.111
E=1. When E is positive, move right from point, when it’s negative move left
moves one space
01.11
1+0.5+0.25= 1.75
if mantissa doesn’t start with 01 or 10, normalise it first. by working out what the number is first ^ and then making it so it starts with 10 or 01
floating-point binary:
Increasing the mantissa size:
Increasing the exponent size:
Bitwise Shifts:
Bitwise Masks:
character set
ASCII
(American Standard Code for Information Interchange)
Extended ASCII