Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Representation Kieran Mathieson. Outline Digital constraints Data types Integer Real Character Boolean Memory address.

Similar presentations


Presentation on theme: "Data Representation Kieran Mathieson. Outline Digital constraints Data types Integer Real Character Boolean Memory address."— Presentation transcript:

1 Data Representation Kieran Mathieson

2 Outline Digital constraints Data types Integer Real Character Boolean Memory address

3 Digital Constraints All we have to work with are electronic components Easier to build accurate digital circuits than analog Encode data in ways that can be implemented using cheap electronic components

4 Digital Constraints NOT gate

5 Digital Constraints OR/NOR gate

6 Digital Constraints NAND gate

7 Digital Constraints An Adder

8 Digital Constraints A Memory Cell (1 bit)

9 Digital Constraints

10 Binary data – 1 and 0 Fixed number of binary places

11 Outline Digital constraints Data types Integer Real Character Boolean Memory address

12 Data Types 1. Integer 2. Real number 3. Character 4. Boolean 5. Memory address

13 Integers An integer is a whole number (For example: 3, 5, 6) Integers can be signed or unsigned A signed integer uses one bit to represent the sign The sign bit is the high order bit

14 Integers

15 Range and Overflow If data is too large to store in the 32 or 64 bits, then overflow occurs Overflow is treated as an error by the CPU To avoid overflow some computers and programming languages define additional data types as double precision (long integer)

16 Floating Point

17 Floating Point (IEEE Format) Issues: range, overflow, underflow, precision, truncation

18 Characters Mapping from a glyph to a number

19 Characters The most common in computing is ASCII Has 127 characters Need 7 bits to represent ASCII characters * = 42, 0 = 48, A = 65 Low numbers reserved for control characters Some national variants of ASCII US version is often called US-ASCII

20 Characters

21

22 ISO Latin 1 8-bit code First 127 values same as ASCII Values 128-256 used for other characters ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ

23 Unicode Multilingual character encoding standard encompassing all of the world’s written languages. Characters are coded using 16 bit strings. About 40,000 characters are represented.

24 UTF-8 Unicode characters occur with different frequencies Spaces are common Arabic characters are relatively uncommon Represent common Unicode characters using one byte Represent uncommon ones using 3 or 4 bytes

25 UTF-8 Preserves ASCII characters

26 Who Cares? Different software uses different default character sets. Need to specify a character set if you want to ensure that characters display correctly. Windows uses CP-1252 by default Files can contain character set information

27 Browsers From HTTP 1.1 specification: When no explicit charset parameter is provided by the sender, media subtypes of the text type are defined to have a default charset value of ISO-8859-1 when received via HTTP. Data in character sets other than ISO-8859-1 or its subsets MUST be labelled with an appropriate charset value.

28 UTF-8 Again Many people are recommending UTF-8, since it is compact but can still represent lots of characters. Client support will be spotty for years. To test a client, go to: http://www.w3.org/2001/06/utf-8-test/UTF-8- demo.html

29 Outline Digital constraints Data types Integer Real Character Boolean Memory address

30 Boolean True/false Can use one bit in theory But in practice computers do not fetch a byte at a time from memory In loosely-typed languages, sometimes 0 is interpreted as false and anything else as true

31 Memory Addresses Represents an address in memory A variable with an address is often called a pointer Number of bytes needed for an address depends on how many address bits the CPU has (address space) Z80 - 64K address space - 16 bit pointers Intel 8086 - 1M address space - 20 bit pointers

32 Outline Digital constraints Data types Integer Real Character Boolean Memory address


Download ppt "Data Representation Kieran Mathieson. Outline Digital constraints Data types Integer Real Character Boolean Memory address."

Similar presentations


Ads by Google