Floating Point Binary A2 Computing OCR Module 2509.
-
Upload
reynold-oconnor -
Category
Documents
-
view
219 -
download
0
description
Transcript of Floating Point Binary A2 Computing OCR Module 2509.
![Page 1: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/1.jpg)
Floating Point Binary
A2 ComputingOCR Module 2509
![Page 2: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/2.jpg)
Negative Binary Numbers
90909090909090 432109
• 410 = 00000100• 310 = 00000011• 210 = 00000010• 110 = 00000001• 010 = 00000000• -110 = ?
Imagine a milometer…
![Page 3: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/3.jpg)
Negative Binary Numbers
9999999 987
• 410 = 00000100• 310 = 00000011• 210 = 00000010• 110 = 00000001• 010 = 00000000• -110 = 11111111• -210 = 11111110• -310 = 11111101• -410 = 11111100
6
Two’s complement
Imagine a milometer…
![Page 4: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/4.jpg)
Negative Binary Numbers: The Easy Method
1. Starting from the right, leave the digits alone up to the first 1
2. Change all the other digits from 1 to 0 or 0 to 1
0011010 0LeaveFlip
8810 =
- 8810 =
001
0101
0
Two’s complement
sign (0 ≡ positive; 1 ≡ negative)
![Page 5: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/5.jpg)
Floating Point Binary
110100000 0000110mantissa exponentsign
Imagine a 2 byte, 16 bit, number…
The sign tells us it is a positive number (0 ≡ positive, 1 ≡ negative)The mantissa and exponent tell us that that the number is 0.1101 x
23
0.1101 x 23 ≡ 110.1 ≡ 6.510
![Page 6: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/6.jpg)
Floating Point Binary: Negative Exponent
110100000 1111100mantissa exponentsign
If the leading bit of the exponent is 1, the exponent is negative…
0.1101 x 2-2 ≡ 0.001101 ≡ 1/8+1/16+1/64
N.B. If the exponent is negative, it will be written in two’s complement
1. Therefore, first convert the exponent from two complement to base 10:
111110 = -000010 = -2
2. Number is therefore 0.1101 x 2-2
≡ 0.203125
![Page 7: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/7.jpg)
Normalisation of Floating Point Binary Numbers
In base 10:
234,567,000 ≈ 0.002346 x 1011
234,567,000 = 0.234567 x 109
This number is normalised:it uses the mantissa to give the most
accurate representation of the numberby making sure the first digit after the
decimal place is significant (i.e. not a zero)
This has lostsome accuracy and precision
![Page 8: Floating Point Binary A2 Computing OCR Module 2509.](https://reader036.fdocuments.in/reader036/viewer/2022082501/5a4d1af27f8b9ab05997f4c6/html5/thumbnails/8.jpg)
Normalisation of Floating Point Binary Numbers
• Normalise the floating point binary number 0 000110101 000010
• What do we know?– It is a positive number– It has a positive exponent
• The number, as it stands, is 0.000110101 x 22
= 0.0110101 Normalised: = 0.110101 x 2-1
• We need the binary equivalent of -1 to represent the exponentN.B. The exponent is negative so will need to be two’s complementTwo’s complement of -1 is 111111
• So, the normalised version of 0 000110101 000010 is: 0.110101000 111111
The sign bit is a 0The leftmost bit of the exponent is also 0