IEEE 754 标准规定了三种浮点数格式:单精度、双精度、扩展精度。《编程卓越之道》第一部的 4.2 节对这些浮点数格式已进行了详细的讲解,为了让读书笔记更像读书笔记,本文只道出个人的一些理解以及一些疑惑之处。
话说 Intel 计划给最早的 8086 增加浮点运算单元 (FPU) 时,他们请来了最好的数值分析专家来为 8087 FPU 设计浮点数格式,这位专家接着又请来了该领域的另外两位专家,这三个人 (Kahn, coonan 与 Stone) 设计了 Intel 的浮点格式,即 KCS 浮点数标准。这个标准实在太出色了,因此 IEEE 组织将 KCS 选作为 IEEE 浮点数格式的基础,即 IEEE 标准 754。
IEEE 754 标准所定义的单精度浮点数的长度为 32 位,按位域可划分为:符号位、阶码位与尾数位,如下:
31----------------------22---------------------------------------------------------0 | | | X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X | |-------------------| |----------------------------------------------------------| 符号 阶码 尾数
符号位取 0 表示正数,取 1 表示负数。
阶码位是 8 位,这里有一点小门道需要注意,那就是的指数 n 并不能直接当作阶码来处理,需要将其与 127 (0x7f) 相加才可得到 的阶码表示。
尾数的位域长度在图示中是 23 位,但实际上却是 24 位,这个位是“不可见”的,其值固定为 1,这也就是说 IEEE 754 标准所定义的浮点数,其有效数字是介于 1 与 2 之间的小数。
可以尝试写一下 1.0 这个数的二进制单精度浮点格式,这有助于更好地理解单精度浮点数格式的位域分布。
1.0 的二进制单精度浮点格式:0 0111 1111 000 0000 0000 0000 0000 0000
值得注意的一个问题是:书上说之所以要将指数加上 127 来得到阶码,是为了简化浮点数的比较运算,这一点我没有体会出来。但是通过 127 这个偏移量 (移码),可以区分出指数的正负。阶码为 127 时表示指数为 0;阶码小于 127 时表示负指数;阶码大于 127 时表示正指数。
第二个值得思考的问题是:使用 24 位尾数,大概可以得到 个十进制数字的精度,其中的“半个”数字由 FPU 的好意而产生的一个随机数字,这个数字通常接近 5 (四舍五入?)。
第三个问题是我经常要碰到的:IEEE 754 标准所定义的单精度浮点数所表示的数的范围是多少?书上给出的答案是大约为 或者大约 。这个比较好理解,因为尾数的最大值是接近 2,而指数的范围是 [-127, 127],那么这个范围就可以表示为。
相对于单精度浮点数格式,双精度的阶码变为 11 位,移码变为为 1,023,尾数变为 53 位 (包含那个固定为 1 的隐含位)。这样,再加上符号位,双精度浮点数的长度为 64 位,提供了大约 的动态范围以及 个数字的精度。
63-62------------51-------------------------------------------------------------0 | | | | X XXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX | |-------------|--------------------------------------------------------------| 符号 阶码 尾数
为了追求更高的浮点运算精度,Intel 又搞出来扩展精度格式。扩展精度的浮点数长度为 80 个位,相对于双精度浮点数所多出来的 16 个位,有 12 位加入到尾数位中,有 4 位加入到阶码位中。
2022年8月27日 21:16
The Primary School Certificate Examination tests 2022 are successfully completed in November for all education boards across the country all divisions, and they have going to announce PSC Result 2022 Sylhet Board with full mark sheet under DPE along with Sylhet board for the academic terminal examination tests. PSC Result Sylhet Board Based on the DPE announcement there are 30 lacks of students are participated from all divisions across the country for this Primary Education Course (PEC) from all education boards included the Sylhet board, every year those Grade-5 Terminal annual final exams are conducted under the Directorate of Primary Education (DPE) and this year also conducted same without delay.
2023年11月01日 19:14
You have performed a great job on this article. It’s very precise and highly qualitative. You have even managed to make it readable and easy to read. You have some real writing talent. Thank you so muc
2023年11月12日 13:49
"Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”.Extraordinary article as usual. I don't typically remark , anyway I have been devouring your information for at some point now and this article came at a perfect time.
"
2023年11月12日 14:39
"Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”.Extraordinary article as usual. I don't typically remark , anyway I have been devouring your information for at some point now and this article came at a perfect time.
"
2023年11月12日 15:33
I genuinely acknowledge fundamentally scrutinizing most of your weblogs. Simply expected to prompt you that you have people like me who worth your work. Absolutely a magnificent post. Tops off to you! The information that you have given is particularly used.
2023年11月12日 15:43
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
2023年11月12日 16:09
That is truly something that we consider a ton. At the point when we thought up our key course of action, the fundamental segment was people. Hopkins is mind blowing because of the overall public who work here and learn here, so it's critical to use to keep them fulfilled and locked in.
2023年11月12日 16:21
Hi I found your site by mistake when i was searching yahoo for this acne issue, I must say your site is really helpful I also love the design, its amazing!. I don’t have the time at the moment to fully read your site but I have bookmarked it and also add your RSS feeds. I will be back in a day or two. thanks for a great site.
2023年11月12日 16:27
That is really something that we think about a ton. Right when we concocted our key strategy, the key section was individuals. Hopkins is mind blowing due to the general open who work here and learn here, so it's basic to use to keep them satisfied and secured.
2023年11月12日 16:33
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
2023年11月12日 16:35
Hi what an awe inspiring post I have gone over and trust me I have been paying special mind to this similar kind of post for late week and scarcely kept running over this. Much thanks and will look for more postings from you.
2023年11月12日 16:53
Hi what an awe inspiring post I have gone over and trust me I have been paying special mind to this similar kind of post for late week and scarcely kept running over this. Much thanks and will look for more postings from you.
2023年11月12日 17:30
"Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! Your weblog provided us with precious records to paintings with. each & every suggestions of your publish are amazing.
"
2023年11月12日 18:34
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
2023年11月12日 18:52
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
2023年11月12日 19:05
with your conclusions and will eagerly look forward to your next updates. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.
2023年11月12日 19:08
Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.
2023年11月12日 19:12
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!You have raised an important issue..Thanks for sharing..I would like to read more current affairs from this blog..keep posting..
2023年11月12日 19:26
"Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”.Extraordinary article as usual. I don't typically remark , anyway I have been devouring your information for at some point now and this article came at a perfect time.
"
2023年11月12日 19:39
Much obliged to you again for all the learning you disperse, Good post. I was extremely intrigued by the article, it's very rousing I ought to concede. I like visiting your site since I generally go over intriguing articles this way one.
2023年11月12日 19:39
"Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”.Extraordinary article as usual. I don't typically remark , anyway I have been devouring your information for at some point now and this article came at a perfect time.
"
2023年11月12日 19:59
Much obliged to you again for all the learning you disperse, Good post. I was extremely intrigued by the article, it's very rousing I ought to concede. I like visiting your site since I generally go over intriguing articles this way one.
2023年11月12日 20:01
I genuinely acknowledge fundamentally scrutinizing most of your weblogs. Simply expected to prompt you that you have people like me who worth your work. Absolutely a magnificent post. Tops off to you! The information that you have given is particularly used.
2023年11月12日 20:12
That is truly something that we consider a ton. At the point when we thought up our key course of action, the fundamental segment was people. Hopkins is mind blowing because of the overall public who work here and learn here, so it's critical to use to keep them fulfilled and locked in.
2023年11月12日 20:20
Hello what a dazzling post I have gone over and trust me I have been paying extraordinary personality to this comparative sort of post for late week and hardly continued running over this. Much thanks and will search for more postings from you.
2023年11月12日 20:24
That is really something that we think about a ton. Right when we concocted our key strategy, the key section was individuals. Hopkins is mind blowing due to the general open who work here and learn here, so it's basic to use to keep them satisfied and secured.
2023年11月12日 20:30
Hello, Your blog is enlightening. It is decent to peruse such fantastic substance. Appealing data on your blog, thank you for taking the time and offer with us. Myassignmenthelp conveys amazing substance identified with programming task help.
2023年11月12日 20:31
"A devotion of gratefulness is all together for all the exertion in sharing this amazing post and I truly to welcome it. Your obligation and dependable work has helped you to pass on amazing quality articles as such Stunning learning and I like to impart this sort of data to my companions and expectation they like it they why I do.
"
2023年11月12日 20:44
"A devotion of gratefulness is all together for all the exertion in sharing this amazing post and I truly to welcome it. Your obligation and dependable work has helped you to pass on amazing quality articles as such Stunning learning and I like to impart this sort of data to my companions and expectation they like it they why I do.
"
2023年11月12日 20:45
That is genuinely something that we think about a ton. Right when we concocted our key game-plan, the central fragment was individuals. Hopkins is mind blowing in light of the general open who work here and learn here, so it's basic to use to keep them satisfied and secured.
2023年11月12日 20:56
After investigation a portion of the substance in your site now, and I likewise extremely much like your system of blogging. I bookmarked it to my bookmark site list and will likewise be returning soon. Pls investigate my web website also and disclosed to me what you accept.
2023年11月12日 21:07
That is really something that we think about a ton. Right when we concocted our key strategy, the key section was individuals. Hopkins is mind blowing due to the general open who work here and learn here, so it's basic to use to keep them satisfied and secured.
2023年11月12日 21:15
The "Perfect Cupcake" review is concise and highlights the cupcake's quality. It mentions taste, texture, and presentation. To improve, it could include specific flavor details or unique elements. Sharing personal experiences or ideal occasions could also be beneficial. Overall, the review is good, but more detailed descriptions and personal touches could enhance it.
2023年11月12日 21:39
Hi I found your site by mistake when i was searching yahoo for this acne issue, I must say your site is really helpful I also love the design, its amazing!. I don’t have the time at the moment to fully read your site but I have bookmarked it and also add your RSS feeds. I will be back in a day or two. thanks for a great site.
2023年11月12日 22:01
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
2023年11月12日 22:25
"Great site! I really love the amazing way it is simple on my eyes it is. I am considering how I may be told at whatever point another post has been made. I have bought in to your RSS which may work? Have an incredible dayI think this is an enlightening post and it is exceptionally helpful and educated. in this manner. I might want to thank you for the endeavors you have made recorded as a hard copy this article.
"
2023年11月12日 22:31
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
2023年12月07日 03:57
Navigating the 백링크 landscape requires strategy and dedication. Learn the ropes of cultivating high-quality connections and watch your website's SEO flourish.
2023年12月10日 18:31
Experience authentic conversations on 달리머넷. It's a valuable platform for sharing experiences and gaining insights.
2023年12月10日 19:04
I had a fantastic trip with 청주공항렌트카 Rental Mall 114.
2023年12月11日 21:05
오피가이드's expertise in OP is unmatched. I trust their recommendations for a memorable OP adventure.
2023年12月11日 22:27
티비몬's journey from Noonoo TV is a story of triumph over adversity.
2023年12月12日 15:36
I've heard 제주비키니룸's decor is impeccable. Excited to see the attention to detail firsthand.
2023年12月13日 18:50
I've heard great things about the entertainment at 오피. Can't wait to check it out!
2023年12月13日 20:28
The user-friendly interface of 설문조사 사이트 on Tipping makes it an excellent choice for users of all skill levels.
2023年12月16日 13:33
There are a few fascinating points in time on this page but I don’t know if these center to heart. There’s some validity but I am going to take hold opinion until I check into it further. Excellent article , thanks and we want much more! Included with FeedBurner likewise 실시간스포츠중계
2023年12月17日 19:10
Experience OP like never before with "오피가이드." Stay in the loop and enhance your relaxation journey.
2023年12月17日 22:05
Discover the wonders of 인천출장마사지. Say goodbye to stress and hello to customized, location-based relaxation. The perfect solution for busy lives.
2023年12月20日 17:35
The absence of subscription fees on 누누티비 makes it a cost-effective choice.
2023年12月23日 21:45
Dive into EPL with epl무료중계's in-depth analysis and real-time scores.
2023年12月28日 19:20
Winning big at 에볼루션카지노 is a dream come true!
2023年12月31日 22:55
강남오피's innovation in wellness is impressive. Cutting-edge treatments!
2024年1月01日 13:28
I genuinely treasure your work , Great post. 프리카지노
2024年1月15日 15:39
You understand so much its practically challenging to argue along (not too I actually would want…HaHa). You certainly put the latest spin with a topic thats been discussed for decades. Great stuff, just wonderful!
2024年1月15日 17:46
Excellent, this article is really helpful. Mes doubles dans autres produits
2024年1月15日 18:37
Uncommon tips and clear. This will be to a great degree supportive for me when I get a chance to start my blog
2024年1月15日 19:41
I invite you to the page where you can read with interesting information on similar topics.
2024年1月15日 20:22
I read this article. I think You put a great deal of exertion to make this article. I like your work.
2024年1月15日 21:00
Thankyou for taking the time to write this it was a great read. Good job!
2024年1月16日 13:41
Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading
2024年1月16日 14:09
Your blogs are easily accessible and quite enlightening so keep doing the amazing work guys.
2024年1月16日 17:08
You have done an amazing job with you website
2024年1月16日 17:47
I have been exploring for a little bit for any high quality articles or weblog posts in this sort of house . Exploring in Yahoo I finally stumbled upon this web site. Studying this info So i am glad to exhibit that I’ve a very just right uncanny feeling I discovered exactly what I needed. I so much definitely will make sure to don¦t disregard this website and give it a look on a continuing basis.
2024年1月18日 14:00
I have added and shared your site to my social media accounts to send people back to your site because I am sure they will find it extremely helpful too.
2024年1月18日 16:25
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. <a href="https://linktr.ee/ReubenGloverJr">Easy1Up Review</a>
2024年1月22日 14:02
온라인 카지노 커뮤니티 온카허브 입니다. 온카허브는 카지노 먹튀 사이트들과 안전한 카지노 사이트 정보를 공유하고 있습니다. 카지노 먹튀검증 전문팀을 자체적으로 운영함으로써 철저한 검증을 진행하고 있습니다.
https://oncahub24.com/
2024年1月22日 14:47
온라인 카지노 커뮤니티 온카허브 입니다. 온카허브는 카지노 먹튀 사이트들과 안전한 카지노 사이트 정보를 공유하고 있습니다. 카지노 먹튀검증 전문팀을 자체적으로 운영함으로써 철저한 검증을 진행하고 있습니다.
2024年1月24日 10:12
카지노사이트 바카라사이트 우리카지노 카지노는 바카라, 블랙잭, 룰렛 및 슬롯 등 다양한 게임을 즐기실 수 있는 공간입니다. 게임에서 승리하면 큰 환호와 함께 많은 당첨금을 받을 수 있고, 패배하면 아쉬움과 실망을 느끼게 됩니다.s
2024年1月24日 10:31
하노이 꼭 가봐야 할 베스트 업소 추천 안내 및 예약, 하노이 밤문화 에 대해서 정리해 드립니다. 하노이 가라오케, 하노이 마사지, 하노이 풍선바, 하노이 밤문화를 제대로 즐기시기 바랍니다. 하노이 밤문화 베스트 업소 요약 베스트 업소 추천 및 정리. https://hanoi-nightlife.com/
2024年1月25日 12:07
베트남 남성전용 커뮤니티❣️ 베트남 하이에나 에서 베트남 밤문화를 추천하여 드립니다. 베트남 가라오케, 베트남 VIP마사지, 베트남 이발관, 베트남 황제투어 남자라면 꼭 한번은 경험 해 봐야할 화끈한 밤문화로 모시겠습니다. https://vn-hyena.com/
2024年1月25日 12:20
No.1 먹튀검증 사이트, 먹튀사이트, 검증사이트, 토토사이트, 안전사이트, 메이저사이트, 안전놀이터 정보를 제공하고 있습니다. 먹튀해방으로 여러분들의 자산을 지켜 드리겠습니다. 먹튀검증 전문 커뮤니티 먹튀클린만 믿으세요!!
2024年6月01日 13:03
The tech-original mission is to help you better understand technology, and make better decisions in the fields of IT, Tech, and Crypto.
https://www.tech-original.com/
2024年6月07日 15:50
The tech-original mission is to help you better understand technology, and make better decisions in the fields of IT, Tech, and Crypto.
https://www.tech-original.com/