1.4.1 Flashcards
data types (5)
Integer
Real/float
Boolean
Character
String
primitive data type
any basic data type provided by a language as a foundational building block
integer
represents any positive or negative whole number
real
real or float
any real world quantity as a number
floating point
real or float
any real world quantity as a number
character
represents a single character – this can be any alphanumeric character or symbol
string
represents a collection of characters
it can include any alphanumeric characters or symbols
boolean
represent one of two truth values associated with logic and Boolean algebra – typically, true or false
binary - sign and magnitude
first bit
0 = positive
1 = negative
binary - 2s complement
first bit
0 = positive
1 = negative
but if -ve then all other 1s are adding to the -ve first bit
subtraction of binary
e.g. 73 - 106 —-> 73 + -106 (use 2s complement)
hexidecimal
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
floating point in binary
always uses 2s complement
as you go –> along it halves
binary - mantissa
The number itself
binary - exponent
The position of the binary point in the number
(always uses 2s complement)
+ve decimal moves –> along
-ve decimal moves <– along