Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Representation 3 This week – Recap on Floating point number – ASCII – unicode.

Similar presentations


Presentation on theme: "Data Representation 3 This week – Recap on Floating point number – ASCII – unicode."— Presentation transcript:

1 Data Representation 3 This week – Recap on Floating point number – ASCII – unicode

2 Floating-point numbers Often we want to represent very small, very large numbers or numbers with fractional parts. For example,33550000 or 0.00000001451. One way of doing this is scientific notation where these numbers are split into two parts a number with a decimal point within it (called the mantissa) and a power of 10 (called the exponent).

3 Fixed NotationScientific NotationMantissaExponent 335500000.3355x10 8 0.33558 0.000000014510.1451x10 -7 0.1451-7

4 The decimal number 5.625 could be represented as 101.101. If we use this mantissa and exponent idea, it could also be written as 1.01101x2 2 (Normalised) where the exponent shows the final position of the binary point relative to the current position. Because the binary point can be altered depending on the magnitude of the exponent, it often refereed to as a floating-point representation.

5 IEEE standard (single precision) SignExponentMantissa Bit 31Bits 23-30Bits 0-22 -ve131 10 0.265625 10 11000001001000100000000000000000

6 Features with floating point representation Gives a wide range of numbers It is not precise Precision and Range can be improved using more bits (64 bits in Double precision) – Bit 63 for sign, – bits 52-62 for exponent – Bits 0 to 51 for mantissa

7 Summary on floating point numbers Use of mantissa and exponent in floating point numbers. Advantages and disadvantages of floating point number. IEEE standard

8 IEEE standard (single precision) SignExponentMantissa Bit 31Bits 23-30Bits 0-22 -ve131 10 0.265625 10 11000001001000100000000000000000

9 Text Representation Up to know we have looked at storing number, can be store text. If we could not then this text would not be on the screen. So we need a way of storing letters and characters.

10 ASCII Most common text representation. Each character has a code. Special characters such as space, return, etc have codes. American Standards Code for Information Interchange. Alternatives: EBCDIC not widely used.

11 ASCII 01234567 0NULDCL0@P‘p 1SOHDC1!1AQaq 2STXDC2“2BRbr 3ETXDC3#3CScs 4EOTDC4$4DTdt 5ENQNAK%5EUeu 6ACKSYN&6FVfv 7BELETB‘7GWgw 8BSCAN(8HXhx 9HTEM)9IYiy ALFSUB*:JZjz BVTESC+;K[k{ CFFFS, N^n~ FSIUS/?O_oDEL

12 ASCII So what is the code for A? Go to the table and find A it is on the column marked 4 and row marked 1. This can be used to give a hexadecimal number – Column gives the higher hexadecimal number. – Row gives the low hexadecimal number. There A is 41 16 What is this code as a decimal number? 41 10 or 65 10 ?

13 UNICODE ASCII used 7 bits (often the 8 th bit used to help check the data was transferred correctly). Therefore, limited a small character set.

14 UNICODE UNICODE is a 16-bit system, and can deal with the requirements of the modern system, with the need for different character sets for different languages and symbols (such as accents) Java and Windows XP can support UNICODE

15 UNICODE Every character has a unique 16-bit value called code point. First 0-255 map on to ASCII. No characters made up of multiple characters such as \n. Makes programming easier all characters take the same amount of memory. In a 16bit system there are 65 536 different code points. All the worlds languages together use 200000 characters. Does not cover all symbols.

16 Revision activities What is the ASCII value of the following: – a space – letter b How many different codes are possible with following: – ASCII – Unicode.

17 Further reading on text Chalk et al (2004) pages 11-12 and 257-259. Tanenbaum (2005) pages 127-131


Download ppt "Data Representation 3 This week – Recap on Floating point number – ASCII – unicode."

Similar presentations


Ads by Google