COMP0068 Lecture10 High Level Data Types
COMP0068 Lecture10 High Level Data Types
Operating Systems
Lecture 10: High-level Data Types
Background Reading:
Irv Englander (Chapter 3 & 5)
Harris & Harris Section 5.3
Lecture Overview
• We have looked at how MIPS assembly can process a
number of key data types:
– Signed and unsigned 32-bit integer words (integers).
– Bytes and half-words (shorts).
– Arrays of integers
Strings of Characters
• Python class “str” is internally complex and
employs Unicode characters.
• But C-language representation of a string is much
simpler:
5
And decimal to binary …
One way of converting from decimal to binary is by
first dividing by the largest power of two … and
then successively dividing by smaller ones …
Quotient
(Result)
MSB 1 0 1 LSB
22 ) 5 21 ) 1 20 ) 1 0
à 1012
Remainder
REAL NUMBERS
The series
-1 -2 -m
s-12 + s-22 + ............. + s-m2 + ...
3.62510 = 11.1012
Combine the results from integer and fractional part, 5.7510 = 101.112
Fixed Point Representation of Real Numbers
= 11110.01112 + 00000.00012
= 11110.10002
Check the result:- …000001.12
1.1 + (-1.1) = 0 …111110.12
…000000.0
S E F
1-bit 8-bits 23-bits
IEEE Single Precision Format Example
Turn –12.7510 into single precision form.
S E F
1-bit 8-bits 23-bits
1.00000000000000000000000 x 2-126
Min E = 0000 00012
Infinity
• Infinity is a special value represented with maximum E and
F =0
• For single precision with 8 bit exponent: maximum E= 255
• Infinity can result from overflow
• +infinity and –Infinity are possible according to sign bit S