Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Data Formats Industrial Informatics, Production and Logistics by Wolfgang Neff.

Similar presentations


Presentation on theme: "Computer Data Formats Industrial Informatics, Production and Logistics by Wolfgang Neff."— Presentation transcript:

1 Computer Data Formats Industrial Informatics, Production and Logistics by Wolfgang Neff

2 Numeral Systems (1) Our numeral system uses 10 digits to represent all numbers. –0, 1, 2, 3, 4, 5, 6, 7, 8, 9 –base-ten numeral system The value of a digit depends on its position: positional numeral system The values of numbers have to be calculated. –2005 = 2∙1000 + 0∙100 + 0∙10 + 5∙1 –MMV = 1000 + 1000 + 5 (in contrast to above)

3 Numeral Systems (2) Generalisation –Base-b Numeral Systems. –Base: Number of digits –Value:

4 Decimal System (1) Base: 10 –base-ten numeral system Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Value of a decimal number –1001 = 1∙10 3 + 0∙10 2 + 0∙10 1 + 1∙10 0 1∙1000 + 0∙100 + 0∙10 + 1∙1 1001 dec

5 Decimal System (2) Representation of a decimal number –1001 =1001 ÷ 10= 100remainder 1 100 ÷ 10= 10remainder 0 10 ÷ 10= 1remainder 0 1 ÷ 10= 0remainder 1 1001 dec Number range of a given number of digits –10 Number of digits –4 digits: 10 4 = 10000  0 … 9999 ready reading direction

6 Binary System (1) Base: 2 –base-two numeral system Digits: 0, 1 Value of a binary number –1001 = 1∙2 3 + 0∙2 2 + 0∙2 1 + 1∙2 0 1∙8 + 0∙4 + 0∙2 + 1∙1 9 dec

7 Binary System (2) Representation of a binary number –9 =9 ÷ 2= 4remainder 1 4 ÷ 2= 2remainder 0 2 ÷ 2= 1remainder 0 1 ÷ 2= 0remainder 1 1001 bin Number range of a fixed number of digits –2 Number of digits –4 digits: 2 4 = 16  0 … 15

8 Binary Numbers (1) Computers only understand two states. –Current is flowing / Current is not flowing –Switch on / Switch off These two states are denoted by –0 / 1 or H / L (H for high, L for low) All data has to be encoded by these two states. Computers use the base-two system.

9 Binary Numbers (2) A binary digit is called bit. Bits are grouped as a single bit contains only very little information : –4 bits: Nibble –8 bits: Byte –16 bits: Word –32 bits: Double Word

10 Binary Numbers (3) Bytes are used to measure storage media. To keep numbers handy binary prefixes (Kilo, Mega, Giga, Terra etc.) are used. Binary prefixes are powers of 1024 (2 10 ). –1 KByte (KB): = 1024 1 Bytes = 1024 Bytes –1 MByte (MB): 1024 KB = 1024 2 Bytes = 1,048,576 Bytes –1 GByte (GB): 1024 MB = 1024 3 Bytes = 1,073,741,824 Bytes –1 TBytte (TB): 1024 GB = 1024 4 Bytes = 1,099,511,627,776 Bytes

11 Binary Numbers (4) Binary Numbers are difficult to read. There- fore four of them are grouped and a new digit assigned to. 0000001004100081100C 0001101015100191101D 00102011061010A1110E 00113011171011B1111F As sixteen digits are needed this code is a base-sixteen numeral system.

12 Binary Numbers (5) Examples –0000  0– 0110 0100  64 –0111  7– 0111 1010  7A –1010  A– 1011 1100  BC –FFFF  F– 1111 1111  FF 0000001004100081100C 0001101015100191101D 00102011061010A1110E 00113011171011B1111F

13 Hexadecimal System (1) Base: 16 –hex numeral system –base-sixteen numeral system Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Value of a decimal number –1001 = 1∙16 3 + 0∙16 2 + 0∙16 1 + 1∙16 0 1∙4096 + 0∙256 + 0∙16 + 1∙1 4097 dec

14 Hexadecimal System (2) Representation of a hex number –4097 =4097 ÷ 16= 256remainder 1 256 ÷ 16 = 16remainder 0 16 ÷ 16= 1remainder 0 1 ÷ 16 = 0remainder 1 1001 hex Number range of a fixed number of digits –16 Number of digits –4 digits: 16 4 = 65536  0 … 65535 (0 … FFFF)

15 Rapid Conversion Bin → Dec Write 1 above the last digit. Proceed doubling until you reach the beginning. Add all numbers where the digit below has a value of 1. Example: 1286432168421 10110011 10110011 bin = 128+32+16+2+1 = 179 dez

16 Rapid Conversion Dec → Bin Proceed doubling 1 until the result is larger than the number you want convert. Try to subtract both numbers. If it is possible the digit is 1 otherwise it is 0. Example: 17951 193331 1286432168421 10110011 179 dez = 10110011 bin

17 Rapid Conversion Bin ↔ Hex Conversion between bin and hex is most easily done with aid of a hex table. Every nibble can be assigned a hex digit an vice versa. HexBinHexBinHexBinHexBin 000004010081000C1100 100015010191001D1101 2001060110A1010E1110 3001170111B1011F1111

18 Addition (1) Addition has got two particularities. –Carries– Leading Zeros 1 st Number1945 2 nd Number0512 Carry1000 Result2457 Leading Zero

19 Addition (2) Carry We get a carry if the result of an addition can not be expressed by a single digit (e. g. 9+5=14). It is transferred to the next position. Leading Zero Leading zeros can proceed numbers without changing their value (e. g. 0025=25). That way numbers can be filled.

20 Addition (3) 1 st Bit00110011 2 nd Bit01010101 Carry00001111 Result dec 01121223 bin 0001011001101011 Adding two bytes the following situa- tions are encountered.

21 Addition (4) Example of a binary addition 1 st Number01111010 2 nd Number00011100 Carry11110000 Result10010110

22 Fixed Bit Length (1) Number of digits of a binary number. The least valuable bit (rightmost) is called LSB (Least Significant Bit). The most valuable bit (leftmost) is called MSB (Most Significant Bit). 76543210Bit 11101001Number MSB (2 7 =128) LSB (2 0 =1)

23 Fixed Bit Length (2) Fixed bit lengths limit the number of possible values of a binary number. –8 bits: 2 8 → 0...255 –16 bits: 2 16 → 0...65,536 –32 bits: 2 32 → 0...4,294,967,296 The number of possible values is call range.

24 Fixed Bit Length (3) If a binary number exceeds its range an overflow occurs. Bit C 76543210 1 st Number011111111 2 nd Number000000001 Carry111111110 Result100000000 The overflowed bit is called carry bit and is often discarded.

25 Fixed Bit Length (4) As the overflow is discarded binary numbers restart at zero if their range is exceeded. (After 255 0 comes again). The number line becomes a number circle!

26 Negative Numbers (1) By counting beyond zero negative numbers are achieved.

27 Negative Numbers (2) Usually binary numbers whose MSB is set are considered negative. I. e. the MSB tags negative numbers. Example –8 th bit unset:0...127 are positive –8 th bit set:128...255 are negative –128 … 255 → -128 … -1

28 Negative Numbers (3) Positive values are sacrificed to achieve negative numbers. Which numbers are negative depends on the bit length. –Usually:positive:0...2 n-1 -1 negative:-1...-2 n-1 n:bit length

29 Negative Numbers (4) To get the negative of a given number use its two's complement. –Negate all bits of the number (0→1, 1→0) –Add the number 1 Number00011000 Negated Number11100111 +100000001 Carry00001110 Result11101000

30 Floating Point Numbers (1) Floating point numbers are a subset of the rational numbers. Floating point numbers have a distinct data type. All numbers containing a decimal point are considered floating point. Numbers without a decimal point are considered integer.

31 Floating Point Numbers (2) Floating Point Numbers are represented as exponential numbers. 10 to the power … is abbreviated by E. Examples: 5,05.0 · 10 0 5.0E0 3,14193.1419 · 10 0 3.1419E0 1.647.354,01.647354 · 10 6 1.647354E6 0,0033.0 · 10 -3 3.0E-3

32 Floating Point Numbers (3) The part after E is called mantissa. The part before E is called exponent. Floating point numbers are stored as: 4 th Byte3 rd Byte2 nd Byte1 st Byte SEEEEEEEEMMMMMMMMMMMMMMMMMMMMMMM SExponentMantissa Sign

33 Characters (1) Characters are encoded by integer numbers. There are several encoding schemes –ASCII: 7 bit encoding scheme –extended ASCII: 8 bit encoding scheme ANSI (Windows-1252) ISO Latin1 (ISO-8859-1) –Unicode: 32 bit encoding scheme

34 ASCII Lower Hex Digit 0123456789ABCDEF Higher Hex Digit 0 NUL SOH STXETXEOFENQACKBEL BSHTLFVTFFCRSOSI 1 DLEDC1DC2DC3DC4NAKSYNETBCAN EM SUBESC FSGSRSUS 2 !"#$%&'()*+,-./ 30123456789:;<=>? 4@ABCDEFGHIJKLMNO 5PQRSTUVWXYZ[\]^_ 6`abcdefghijklmno 7pqrstuvwxyz{|}~ DEL American Standard Code for Information Interchange: 1968

35 Unicode (1) ASCII is very limited. Not adequate for internationalisation. The solution is Unicode. All characters ever used should be encoded. It uses a 32 bit encoding scheme. –Variants: UTF-8, UTF-16, UTF-32

36 Unicode (2) Unicode is or organised in groups. –Diacritics and Ligatures à, å, ä, æ –Non-Latin writing systems Arabic: العربية Cyrillic: Кириллица –Logographic writing system Chinese: 汉语 –Special purpose characters Mathematics: ·, ×, ÷, ≈, ±, ∫, ∞

37 Important Expressions (1) numbering system digit range decimal system binary system hexadecimal system bit length MSB / LSB Zahlensystem Ziffer Wertebereich Dezimalsystem Binärsystem Hexadezimalsystem Bitbreite MSB / LSB

38 Important Expressions (2) carry leading zero overflow two's Complement floating point number character encoding scheme internationalisation (i18n) Übertrag Führende Null Überlauf Zweikomplement Gleitkommazahl Zeichen Kodierungsschema Internationalisierung


Download ppt "Computer Data Formats Industrial Informatics, Production and Logistics by Wolfgang Neff."

Similar presentations


Ads by Google