{"id":201,"date":"2010-04-18T00:30:32","date_gmt":"2010-04-18T09:30:32","guid":{"rendered":"\/blog\/?p=201"},"modified":"2023-09-21T09:39:11","modified_gmt":"2023-09-21T00:39:11","slug":"computer-architecture-floating-point-notation","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=201","title":{"rendered":"[Computer Architecture] Floating-point notation"},"content":{"rendered":"\n\ucef4\ud4e8\ud130\ub294 \uc22b\uc790\ub97c \uc800\uc7a5\ud560\ub54c \uc6b0\ub9ac\ub4e4\uc774 \uc0ac\uc6a9\ud558\ub294 <font color=\"#ff0000\">10\uc9c4\uc218(decimal)\uc744 \uc0ac\uc6a9\ud558\uc9c0 \n\uc54a\ub294\ub2e4<\/font>.<br \/><br \/>true- false\uc758 \ubc18\ubcf5\uc778 0 1 0 1 1 1 1 0 1 1 1 0 0 \uc774\ub7f0\uc2dd\uc73c\ub85c \uc800\uc7a5\uc744 \n\ud55c\ub2e4.<br \/><br \/>Binary , \uc989, 2\uc9c4\uc218\uc774\ub2e4.<br \/><br \/>\uadf8\ub807\ub2e4\uba74 9.6875\ub77c\ub294 \uc218\ub294 \uc5b4\ub5bb\uac8c \uc800\uc7a5\ud560\uae4c?<br \/><br \/>\uc77c\ub2e8 \ubcf4\uba74, \uc815\uaddc \n\ud45c\ud604(normalized form)\uc774 \uc874\uc7ac\ud55c\ub2e4.<br \/><br \/>32\ube44\ud2b8 \uc911\uc5d0 \uac00\uc7a5 <font color=\"#ff0000\">\ucd5c\uc0c1\uc704 \uc67c\ucabd \n\ube44\ud2b8(MSB)<\/font>\ub294 \ubd80\ud638 \ube44\ud2b8\uc774\ub2e4.<br \/><br \/>1\ub85c \uc138\ud2b8 \ub418\uc5b4 \uc788\uc73c\uba74 \uc74c\uc218\uc774\uace0, 0\uc73c\ub85c \uc138\ud2b8\ub418\uc5b4 \uc788\uc73c\uba74 \uc591\uc218\uc774\ub2e4.<br \/><br \/>\uadf8 \n\ub2e4\uc74c 8\ube44\ud2b8\ub294 <font color=\"#ff0000\">\uc9c0\uc218\ubd80(exponential)<\/font> \uc774\ub2e4. <br \/><br \/>\ub098\uba38\uc9c0 23\ube44\ud2b8\ub294 <font color=\"#ff0000\">\uac00\uc218\ubd80(significant, mantissa)<\/font> \uc774\ub2e4.<br \/><br \/>\uac00\uc218\ubd80\uc758 \ud45c\ud604\uc774 \ub450\uac00\uc9c0 \uc874\uc7ac\ud558\ub294\ub370 \nsignificant \uac00 \uc694\uc998 \uc4f0\uc774\ub294 \uc6a9\uc5b4\uc774\uace0,<br \/><br \/>mantissa \ub294 \uc608\uc804\uc5d0 \ub9ce\uc774 \uc4f0\uc774\ub358 \uc6a9\uc5b4\uc774\ub2e4.<br \/><br \/>\uadf8\ub7fc 9.6875\ub294 \n\uc774\uc9c4\ubc95\uc73c\ub85c 1001.1011 \uc774\ub2e4.<br \/><br \/>\uc5ec\uae30\uc11c \uc774\uc81c \uc815\uaddc\ud45c\ud604\uc2dd\uc73c\ub85c \ubc14\uafd4\uc57c\ud55c\ub2e4.<br \/><br \/>\ub9e8 \ucc98\uc74c 1\uc774 \ub0a8\uc744\ub54c\uae4c\uc9c0 \uc6b0\uce21\uc73c\ub85c \uc774\ub3d9\uc2dc\ud0a4\uace0 \n1\uc744 \ub9cc\ub098\uba74 <br \/><br \/>\uc815\uc218\ubd80\uc5d0 \ub194\ub454\ub2e4. ( 1.0011011 )<br \/><br \/>\uc6d0\ub798 \uc22b\uc790\ub85c \ub9cc\ub4e4\ub824\uba74 \uc67c\ucabd\uc73c\ub85c \uc26c\ud504\ud2b8\uac00 \ud544\uc694\ud558\ub2e4.( \n1.0011011 * 2^3 )<br \/><br \/>\uadf8\ub9ac\uace0 \uc591\uc218 \uc774\ub2c8\uae4c MSB\ub294 0\uc774\ub2e4.<br \/><br \/>\uadf8\ub9bc\uc73c\ub85c \ud655\uc778\ud574\ubcf4\uc790.<br \/><br \/>\n<div style=\"text-align: center; clear: both;\" class=\"imageblock center\"><img loading=\"lazy\" decoding=\"async\" style=\"cursor: pointer;\" onclick=\"popview(this, '90000003_000000000000000DFC1EAB7D')\" src=\"http:\/\/cfs9.tistory.com\/image\/10\/tistory\/2008\/06\/28\/20\/13\/48661ccc764ce\" height=\"79\" width=\"418\"><\/div>\uc774\ub807\uac8c \ub420\uac83\uc774\ub2e4. <br \/><br \/>\uadf8\ub9ac\uace0 \uc774\uac83\uc744 \uc9c1\uc811 \uba54\ubaa8\ub9ac\uc5d0\uc11c \ud655\uc778\ud574\ubcf4\uc790.<br \/>\n<div class=\"dp-highlighter\">\n<div class=\"bar\">\n<div class=\"tools\">&nbsp;<\/div><\/div>\n<ol class=\"dp-cpp\"><li class=\"alt\"><span><span class=\"preprocessor\"><font color=\"#808080\">#include &lt;stdio.h&gt; <\/font><\/span><span>&nbsp; <\/span><\/span> \n<\/li><li><span class=\"keyword\"><strong><font color=\"#006699\">typedef<\/font><\/strong><\/span><span>&nbsp;<\/span><span class=\"keyword\"><strong><font color=\"#006699\">struct<\/font><\/strong><\/span><span>&nbsp;_X86_FLOAT &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>{ &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; <\/span><span class=\"keyword\"><strong><font color=\"#006699\">union<\/font><\/strong><\/span><span>&nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; { &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"datatypes\"><strong><font color=\"#2e8b57\">float<\/font><\/strong><\/span><span>&nbsp;fValue; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"keyword\"><strong><font color=\"#006699\">struct<\/font><\/strong><\/span><span>&nbsp;&nbsp; &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned mantissa :&nbsp;23; &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned exponent :&nbsp; 8; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned sign &nbsp; &nbsp; :&nbsp; 1; &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; &nbsp; }; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; }; &nbsp; <\/span> \n<\/li><li><span>} X86_FLOAT, *PX86_FLOAT; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; <\/span> \n<\/li><li><span class=\"datatypes\"><strong><font color=\"#2e8b57\">int<\/font><\/strong><\/span><span>&nbsp;main(<\/span><span class=\"datatypes\"><strong><font color=\"#2e8b57\">int<\/font><\/strong><\/span><span>&nbsp;argc, <\/span><span class=\"datatypes\"><strong><font color=\"#2e8b57\">char<\/font><\/strong><\/span><span>* argv[]) &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>{ &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; X86_FLOAT &nbsp;xfValue; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; xfValue.fValue =&nbsp;9.6875; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; <\/span><span class=\"keyword\"><strong><font color=\"#006699\">return<\/font><\/strong><\/span><span>&nbsp;EXIT_SUCCESS; &nbsp; <\/span> \n\n<\/li><li class=\"alt\"><span>} &nbsp;<\/span><\/li><\/ol><\/div>&lt;TEXTAREA class=\"cpp\" \nstyle=\"DISPLAY: none\" name=code rows=10 cols=60&gt;#include &lt;stdio.h&gt; \ntypedef struct _X86_FLOAT { union { float fValue; struct { unsigned mantissa : \n23; unsigned exponent : 8; unsigned sign : 1; }; }; } X86_FLOAT, *PX86_FLOAT; \nint main(int argc, char* argv[]) { X86_FLOAT xfValue; xfValue.fValue = 9.6875; \nreturn EXIT_SUCCESS; } &lt;\/TEXTAREA&gt; <br \/><br \/>\uc774\uac83\uc744 \ub514\ubc84\uae45 \ucc3d\uc5d0\uc11c \uc9c1\uc811 \ud655\uc778\ud574\ubcf4\uba74,<br \/><br \/>\n<div style=\"text-align: center; clear: both;\" class=\"imageblock center\"><img loading=\"lazy\" decoding=\"async\" style=\"cursor: pointer;\" onclick=\"popview(this, '90000003_000000000000000DFC1EAB7D')\" src=\"http:\/\/cfs7.tistory.com\/image\/35\/tistory\/2008\/06\/28\/20\/18\/48661dec0e1bc\" height=\"178\" width=\"357\"><\/div><strong>\n<div style=\"text-align: center;\"><strong>&lt;\uadf8\ub9bc1. \ubcc0\uc218\uc758 \ub0b4\uc6a9 \n&gt;<\/strong><br \/><\/div><\/strong><br \/>\n<div style=\"text-align: center; clear: both;\" class=\"imageblock center\"><img loading=\"lazy\" decoding=\"async\" style=\"cursor: pointer;\" onclick=\"popview(this, '90000003_000000000000000DFC1EAB7D')\" src=\"http:\/\/cfs7.tistory.com\/image\/22\/tistory\/2008\/06\/28\/20\/18\/48661ded3188f\" height=\"178\" width=\"499\"><\/div><strong><strong>\n<div style=\"text-align: center;\"><strong>&lt;\uadf8\ub9bc2. \uba54\ubaa8\ub9ac\uc758 \uc0c1\ud0dc \n&gt;<\/strong><br \/><\/div><\/strong><\/strong><br \/>&nbsp;\uc77c\ub2e8 \uc6b0\ub9ac x86\uacc4\uc5f4 \ucef4\ud4e8\ud130\ub294 little-endian \uad6c\uc870\ub97c \n\uc0ac\uc6a9\ud558\ubbc0\ub85c \uad6c\uc870\uccb4\uc758 \uc120\uc5b8\uc21c\uc11c\ub294 \uc5ed\uc21c\uc73c\ub85c \ud558\uc600\ub2e4.<br \/><br \/>(\ud639\uc2dc \uc774\ud574\uac00 \uc548\ub418\uba74 little-endian \ubc0f big-endian \uc744 \uc870\uc0ac\ud574\ubcf4\uba74 \n\uc548\ub2e4.)<br \/><br \/>&nbsp;\uadf8\ub9bc1\uc744 \ubcf4\uba74 mantissa \ubc0f exponent \ubc0f sign\uc5d0 \uc5b4\ub5a4 \uac12\uc774 \ub4e4\uc5b4\uac00 \uc788\ub294\uc9c0 \ubcf4\uc778\ub2e4.<br \/><br \/>\uadf8\ub9ac\uace0 \n\uba54\ubaa8\ub9ac \uad6c\uc870\ub294 ( \ub2f9\uc5f0\ud788 \uacf5\uc6a9\uccb4\uc774\uae30 \ub54c\ubb38\uc5d0 \uacf5\uac04\uc740 4Byte \ub9cc\ud07c )<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>\ucef4\ud4e8\ud130\ub294 \uc22b\uc790\ub97c \uc800\uc7a5\ud560\ub54c \uc6b0\ub9ac\ub4e4\uc774 \uc0ac\uc6a9\ud558\ub294 10\uc9c4\uc218(decimal)\uc744 \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294\ub2e4. true- false\uc758 \ubc18\ubcf5\uc778 0 1 0 1 1 1 1 0 1 1 1 0 0 \uc774\ub7f0\uc2dd\uc73c\ub85c \uc800\uc7a5\uc744 \ud55c\ub2e4. Binary , \uc989, 2\uc9c4\uc218\uc774\ub2e4. \uadf8\ub807\ub2e4\uba74 9.6875\ub77c\ub294 \uc218\ub294 \uc5b4\ub5bb\uac8c \uc800\uc7a5\ud560\uae4c? \uc77c\ub2e8 \ubcf4\uba74, \uc815\uaddc \ud45c\ud604(normalized form)\uc774 \uc874\uc7ac\ud55c\ub2e4. 32\ube44\ud2b8 \uc911\uc5d0 \uac00\uc7a5 \ucd5c\uc0c1\uc704 \uc67c\ucabd \ube44\ud2b8(MSB)\ub294 \ubd80\ud638 \ube44\ud2b8\uc774\ub2e4. 1\ub85c \uc138\ud2b8 \ub418\uc5b4 \uc788\uc73c\uba74 \uc74c\uc218\uc774\uace0, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[24],"tags":[],"class_list":["post-201","post","type-post","status-publish","format-standard","hentry","category-development_winddk"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=201"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/201\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}