当前位置:网站首页>Computer composition and design work05 ——fifth verson
Computer composition and design work05 ——fifth verson
2022-06-12 06:18:00 【JamSlade】
Computer Composition and Design Homework 5
3.20
[5] <§3.5> What decimal number does the bit pattern 0×0C000000 represent if it is a two’s complement integer? An unsigned integer?
- 首位为0,如果是int类型那么说明是正号,
计算过程为
C ( 12 ) × 1 6 6 = 201 , 326 , 592 C(12)\times 16^6 = 201,326,592 C(12)×166=201,326,592 - unsigned int的计算同上
3.22
[10] <§3.5> What decimal number does the bit pattern 0×0C000000 represent if it is a floating point number? Use the IEEE 754 standard
表示为2进制为
0 ( 符 号 位 ) 00011000 ( 指 数 位 ) 0000000000 0000000000 000 ( 小 数 部 分 ) 0\ (符号位) 00011000\ (指数位)0000000000\ 0000000000\ 000(小数部分) 0 (符号位)00011000 (指数位)0000000000 0000000000 000(小数部分)
不难发现这个数是正数,且偏移量为24 - 127 = -103
所以该数为 1.0 × 2 − 103 1.0\times 2^{-103} 1.0×2−103
3.23
[10] <§3.5> Write down the binary representation of the decimal number
63.25 assuming the IEEE 754 single precision format
63.25二进制表示为
111111.01 = 1.1111101 × 2 5 111111.01 = 1.1111101\times 2^{5} 111111.01=1.1111101×25
127+5 = 132 = 10000100(2)
于是表示如下
0 10000100 1111101000 0000000000 000 0\quad 10000100\quad 1111101000\ 0000000000\ 000 0100001001111101000 0000000000 000
3.24
[10] <§3.5> Write down the binary representation of the decimal number
63.25 assuming the IEEE 754 double precision format.
1023+5 = 1028 = 10000000100(2)
0 10000000100 1111101000 0000000000 0000000000 0000000000 0000000000 00 0\quad 10000000100\quad 1111101000\ 0000000000\ 0000000000\ 0000000000\ 0000000000\ 00 0100000001001111101000 0000000000 0000000000 0000000000 0000000000 00
3.25
[10] <§3.5> Write down the binary representation of the decimal number
63.25 assuming it was stored using the single precision IBM format (base 16,
instead of base 2, with 7 bits of exponent).
63.25 = 111111.01 ( 2 ) = 3 F . 40 ( 16 ) = 0.3 F 40 × 1 6 2 63.25 = 111111.01(2) = 3F.40(16) = 0.3F40\times16^2 63.25=111111.01(2)=3F.40(16)=0.3F40×162
标志位为0,指数位为 63 + 2 = 1000001 ( 2 ) 63+2 = 1000001(2) 63+2=1000001(2)
0 1000001 1111101000 0000000000 000 0\quad\ 1000001\quad 1111101000\ 0000000000\ 000 0 10000011111101000 0000000000 000
看答案貌似写指数位是64+2,对此表示存疑,指数127用于表示溢出,0表示0,感觉应该也是63作为中间量才对
3.26
[20] <§3.5> Write down the binary bit pattern to represent − 1.5625 × 1 0 − 1 -1.5625 \times 10^{-1} −1.5625×10−1assuming a format similar to that employed by the DEC PDP-8 (the left most 12 bits are the exponent stored as a two’s complement number, and the rightmost 24 bits are the fraction stored as a two’s complement number). No hidden 1 is used. Comment on how the range and accuracy of this 36-bit pattern compares to the single and double precision IEEE 754 standards.
− 1.5625 × 1 0 − 1 = − 0.15625 = − 0.00101 ( 2 ) = − 0.101 × 2 − 2 -1.5625 \times 10^{-1} = -0.15625 = -0.00101(2) = -0.101\times2^{-2} −1.5625×10−1=−0.15625=−0.00101(2)=−0.101×2−2
所以指数 2 用 补 码 表 示 为 000000000010 , − 2 为 111111111110 2用补码表示为000000000010,-2为111111111110 2用补码表示为000000000010,−2为111111111110
总的表示为
111111111110 ( 12 位 ) 101000000000 000000000000 ( 24 位 ) 111111111110(12位)\quad101000000000\quad000000000000(24位) 111111111110(12位)101000000000000000000000(24位)
- 指数可以表达的数字为 − 2048 ∼ 2047 -2048\sim2047 −2048∼2047
- 底数可表达 2 − 24 ∼ 1 − 2 − 24 2^{-24}\sim 1-2^{-24} 2−24∼1−2−24
| DEC PDP-8 | 单精度 | 双精度 | |
| 最小正数 | 2 − 24 × 2 − 2048 2^{-24}\times2^{-2048} 2−24×2−2048 | 1 × 2 − 126 1\times2^{-126} 1×2−126 | 1 × 2 − 1022 1\times2^{-1022} 1×2−1022 |
| 最大正数 | ( 1 − 2 − 24 ) × 2 2047 (1-2^{-24})\times2^{2047} (1−2−24)×22047 | ( 1 + 1 − 2 23 ) × 2 127 (1+1-2^{23})\times2^{127} (1+1−223)×2127 | ( 1 + 1 − 2 52 ) × 2 1023 (1+1-2^{52})\times2^{1023} (1+1−252)×21023 |
应该为DEC PDP-8能表示的范围更大
3.27
[20] <§3.5> IEEE 754-2008 contains a half precision that is only 16 bits
wide. Th e left most bit is still the sign bit, the exponent is 5 bits wide and has a bias
of 15, and the mantissa is 10 bits long. A hidden 1 is assumed. Write down the
bit pattern to represent − 1.5625 × 1 0 − 1 -1.5625 \times 10^{-1} −1.5625×10−1
assuming a version of this format, which
uses an excess-16 format to store the exponent. Comment on how the range and
accuracy of this 16-bit fl oating point format compares to the single precision IEEE
754 standard.
− 1.5625 × 1 0 − 1 = − 0.15625 = − 0.00101 ( 2 ) = − 1.01 × 2 − 3 -1.5625 \times 10^{-1} = -0.15625 = -0.00101(2) = -1.01\times2^{-3} −1.5625×10−1=−0.15625=−0.00101(2)=−1.01×2−3
- 符号位为1表示负数
- 指数可表达的部分为1-30,偏移量为15,所以指数用12(01100)表示-3
- 底数部分以0100 0000 00
1 01100 0100000000 1\quad 01100\quad 0100000000 1011000100000000
3.29
[20] <§3.5> Calculate the sum of 2.6125 × 1 0 1 2.6125\times 10^1 2.6125×101and 4.150390625 × 1 0 − 1 4.150390625\times 10^{-1} 4.150390625×10−1by hand, assuming A and B are stored in the 16-bit half precision described in Exercise 3.27. Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps.
2.6125 × 1 0 1 = 26.125 = 1.1010001 × 2 4 2.6125 \times 10^1=26.125 = 1.1010001\times 2^4 2.6125×101=26.125=1.1010001×24
4.150390625 × 1 0 − 1 = 1.1010100111 × 2 − 2 4.150390625\times 10^{-1} = 1.1010100111\times 2^{-2} 4.150390625×10−1=1.1010100111×2−2
向左移动6位以对齐指数
于是有(注意半精度只有11位用于保存)
1.1010001000
1.0000011010100111 /需要注意开头是1,剩下的部分需要舍去
1.1010100010
额外的位(有6位)超过有效位(11)位的一半,应该是进位
最后
1.1010100011 ( 进 位 ) × 2 4 = 26.546875 1.1010100011(进位)\times 2^4 = 26.546875 1.1010100011(进位)×24=26.546875
3.32
[20] <§3.9> Calculate ( 3.984375 × 1 0 − 1 + 3.4375 × 1 0 − 1 ) + 1.771 × 1 0 3 (3.984375 \times 10^{-1} + 3.4375\times 10^{-1})+ 1.771 \times 10^3 (3.984375×10−1+3.4375×10−1)+1.771×103by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit fl oating point format and in decimal.
保留位(Guard bit)、近似位(Round bit)和粘滞位(Sticky bit)。
保留位:近似后的最低位
近似位:保留位的后一位
粘滞位:近似位后的所有位进行或运算后视作一位
3.984375 × 1 0 − 1 = 1.1001100000 × 2 − 2 3.984375 \times 10^{-1} = 1.1001100000\times 2^{-2} 3.984375×10−1=1.1001100000×2−2
3.4375 × 1 0 − 1 = 1.0110000000 × 2 − 2 3.4375\times 10^{-1} =1.0110000000\times 2^{-2} 3.4375×10−1=1.0110000000×2−2
1.771 × 1 0 3 = 1.1011101011 × 2 10 1.771 \times 10^3 = 1.1011101011\times 2^{10} 1.771×103=1.1011101011×210
| (A) | 1.1001100000 | × 2 − 2 \times 2^{-2} ×2−2 |
| (B)+ | 1.0110000000 | × 2 − 2 \times 2^{-2} ×2−2 |
| = | 10.1111100000 | × 2 − 2 \times 2^{-2} ×2−2 |
| = | 1.0111110000 | × 2 − 1 \times 2^{-1} ×2−1 |
| (A+B) | 1.0111110000 | × 2 − 1 \times 2^{-1} ×2−1 |
| = | 0.000000000010111110000 | × 2 10 \times 2^{10} ×210 |
| C | 1.1011101011 | × 2 10 \times 2^{10} ×210(A+B多余的部分是101,超过0.5,应进位) |
| (A+B)+C= | 1.1011101100 | × 2 10 \times 2^{10} ×210 |
| = | 1772 |
3.33
[20] <§3.9> Calculate 3.984375 × 1 0 − 1 + ( 3.4375 × 1 0 − 1 + 1.771 × 1 0 3 ) 3.984375 \times 10^{-1} + (3.4375 \times 10^{-1} + 1.771 \times 10^3) 3.984375×10−1+(3.4375×10−1+1.771×103)by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit fl oating point format and in decimal.
3.984375 × 1 0 − 1 = 1.1001100000 × 2 − 2 3.984375 \times 10^{-1} = 1.1001100000\times 2^{-2} 3.984375×10−1=1.1001100000×2−2
3.4375 × 1 0 − 1 = 1.0110000000 × 2 − 2 3.4375\times 10^{-1} =1.0110000000\times 2^{-2} 3.4375×10−1=1.0110000000×2−2
1.771 × 1 0 3 = 1.1011101011 × 2 10 1.771 \times 10^3 = 1.1011101011\times 2^{10} 1.771×103=1.1011101011×210
| (B) | 0.0000000000010110000000 | × 2 10 \times 2^{10} ×210 |
| + | 1.1011101011 | × 2 10 \times 2^{10} ×210 |
| = | 1.1011101011 | × 2 10 \times 2^{10} ×210 |
| (A) | 0.0000000000011001100000 | × 2 10 \times 2^{10} ×210 |
| + | 1.1011101011 | × 2 10 \times 2^{10} ×210 |
| = | 1.1011101011 | × 2 10 \times 2^{10} ×210 |
| = | 1771 |
3.34
[10] <§3.9> Based on your answers to 3.32 and 3.33, does ( 3.984375 × 1 0 − 1 + 3.4375 × 1 0 − 1 ) + 1.771 × 1 0 3 = 3.984375 × 1 0 − 1 + ( 3.4375 × 1 0 − 1 + 1.771 × 1 0 3 ) (3.984375 \times 10^{-1} + 3.4375 \times 10^{-1}) + 1.771 \times 10^3 = 3.984375 \times 10^{-1} + (3.4375\times 10^{-1} + 1.771 \times10^3) (3.984375×10−1+3.4375×10−1)+1.771×103=3.984375×10−1+(3.4375×10−1+1.771×103)?
并不相同,第一个为1772
第二个是1771
精确的解应该为1771.742187
边栏推荐
- Open the camera in unity3d and display the contents of the camera in the scene as texture2d
- Univariate linear regression model
- Une explication du 80e match bihebdomadaire de leetcode
- JS变量作用域
- Mastering UI development with unity
- PDF. JS help file
- Chartextcnn (Ag dataset - news topic classification)
- Leetcode-1043. Separate arrays for maximum sum
- In unity3d, billboard effect can be realized towards another target
- Pytorch implementation of regression model
猜你喜欢

2D human pose estimation for pose estimation - pifpaf:composite fields for human pose estimation

Leetcode-1260. 2D mesh migration

Sqlite Cross - compile Dynamic Library
![[PowerShell] command line output and adding system environment variables](/img/49/b92175181aa4a3fddfa3adcacf1d72.jpg)
[PowerShell] command line output and adding system environment variables

Directx11 advanced tutorial tiled based deffered shading

Logistic regression model

Simulateur nightGod ADB View log

Touch screen setting for win7 system dual screen extended display

RMB classification II

Univariate linear regression model
随机推荐
sqlite交叉编译动态库
单通道图片的读入
Unity implements smooth interpolation
Word vector training based on nnlm
[reinstall system] 01 system startup USB flash disk production
(UE4 4.27) customize globalshader
Leetcode 第 80 場雙周賽題解
Video based fire smoke detection using robust AdaBoost
English grammar_ Adverb_ With or without ly, the meaning is different
Unity can realize the rotation, translation and scaling script of the camera around the target point on the mobile terminal device
Une explication du 80e match bihebdomadaire de leetcode
Explanation of sensor flicker/banding phenomenon
哈工大信息内容安全实验
In unity3d, billboard effect can be realized towards another target
MNIST handwritten data recognition by CNN
Trunet: short videos generation from long videos via story preserving truncation (thesis translation)
Touch screen setting for win7 system dual screen extended display
Directx11 advanced tutorial cluster based deffered shading
English语法_副词_有无ly,意义不同
Cv2.fillpoly coco annotator segment coordinate conversion to mask image