{"id":218968,"date":"2025-05-24T18:07:59","date_gmt":"2025-05-24T18:07:59","guid":{"rendered":"https:\/\/learnexams.com\/blog\/?p=218968"},"modified":"2025-05-24T18:08:01","modified_gmt":"2025-05-24T18:08:01","slug":"from-decimal-number","status":"publish","type":"post","link":"https:\/\/www.learnexams.com\/blog\/2025\/05\/24\/from-decimal-number\/","title":{"rendered":"From decimal number"},"content":{"rendered":"\n<p>From decimal number<\/p>\n\n\n\n<p>To two complementary base.<br>(you can write 5 digits after the comma)<br>a) 127.375<br>b) -67<br>c) -18.32<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">The Correct Answer and Explanation is:<\/mark><\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Understand the task<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We want to represent <strong>decimal numbers<\/strong> (both positive and negative) as binary numbers in <strong>two\u2019s complement<\/strong> form.<\/li>\n\n\n\n<li>For fractional parts, binary fractions are used (e.g., 0.1 in decimal \u2248 0.00011 in binary).<\/li>\n\n\n\n<li>We will keep up to <strong>5 binary digits after the decimal point<\/strong>.<\/li>\n\n\n\n<li>For negative numbers, we convert the absolute value to binary, then find the two\u2019s complement.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">a) 127.375<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2a: Convert integer part (127) to binary<\/h3>\n\n\n\n<p>127 in decimal to binary:<\/p>\n\n\n\n<p>127 = 26+25+24+23+22+21+202^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^1 + 2^0<br>= 1111111\u2082<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3a: Convert fractional part (0.375) to binary<\/h3>\n\n\n\n<p>Multiply fractional part by 2 repeatedly:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>0.375 \u00d7 2 = 0.75 \u2192 integer part: 0<\/li>\n\n\n\n<li>0.75 \u00d7 2 = 1.5 \u2192 integer part: 1<\/li>\n\n\n\n<li>0.5 \u00d7 2 = 1.0 \u2192 integer part: 1<\/li>\n\n\n\n<li>Fractional part is now zero, stop.<\/li>\n<\/ul>\n\n\n\n<p>Binary fraction: 0.011<\/p>\n\n\n\n<p>Pad to 5 digits after decimal: 0.01100<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Final binary (positive number):<\/h3>\n\n\n\n<p><strong>127.375 = 1111111.01100<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">b) -67<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2b: Convert 67 to binary<\/h3>\n\n\n\n<p>67 decimal to binary:<\/p>\n\n\n\n<p>67 = 64 + 2 + 1 = 26+21+202^6 + 2^1 + 2^0 = 1000011\u2082<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3b: Find two\u2019s complement of 67<\/h3>\n\n\n\n<p>We choose 8 bits to represent integer for clarity:<\/p>\n\n\n\n<p>67 = 01000011 (8 bits)<\/p>\n\n\n\n<p><strong>Two\u2019s complement<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Invert bits: 10111100<\/li>\n\n\n\n<li>Add 1: 10111100 + 1 = 10111101<\/li>\n<\/ul>\n\n\n\n<p>So, -67 in 8-bit two\u2019s complement = <strong>10111101<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">c) -18.32 (approximate fractional part)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2c: Convert 18 to binary<\/h3>\n\n\n\n<p>18 decimal to binary:<\/p>\n\n\n\n<p>18 = 16 + 2 = 24+212^4 + 2^1 = 10010\u2082<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3c: Convert fractional part 0.32 to binary<\/h3>\n\n\n\n<p>Multiply fractional part by 2:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>0.32 \u00d7 2 = 0.64 \u2192 0<\/li>\n\n\n\n<li>0.64 \u00d7 2 = 1.28 \u2192 1<\/li>\n\n\n\n<li>0.28 \u00d7 2 = 0.56 \u2192 0<\/li>\n\n\n\n<li>0.56 \u00d7 2 = 1.12 \u2192 1<\/li>\n\n\n\n<li>0.12 \u00d7 2 = 0.24 \u2192 0<\/li>\n<\/ul>\n\n\n\n<p>Fractional binary: 0.01010 (5 digits)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4c: Combine integer and fractional parts<\/h3>\n\n\n\n<p>18.32 \u2248 10010.01010 (binary)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5c: Convert to two\u2019s complement (negative)<\/h3>\n\n\n\n<p>We consider a fixed bit length to cover integer + fraction. For simplicity, represent integer part in 8 bits:<\/p>\n\n\n\n<p>18 decimal = 00010010<\/p>\n\n\n\n<p>Fractional part: .01010<\/p>\n\n\n\n<p>Combine: 00010010.01010<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6c: Find two\u2019s complement of this binary number<\/h3>\n\n\n\n<p>To find two\u2019s complement of a fractional number:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Invert all bits (including fractional part): Integer part 00010010 \u2192 11101101<br>Fractional part 01010 \u2192 10101<\/li>\n\n\n\n<li>So inverted: 11101101.10101<\/li>\n\n\n\n<li>Add 1 to the least significant bit of fractional part:<\/li>\n<\/ul>\n\n\n\n<p>Adding 1 to .10101:<\/p>\n\n\n\n<p>.10101<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>0.00001<br>= .10110<\/li>\n<\/ul>\n\n\n\n<p>Final two\u2019s complement:<\/p>\n\n\n\n<p><strong>11101101.10110<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>Summary of answers:<\/strong><\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Decimal<\/th><th>Two&#8217;s complement binary (5 fractional bits)<\/th><\/tr><\/thead><tbody><tr><td>a) 127.375<\/td><td>1111111.01100 (positive, normal binary)<\/td><\/tr><tr><td>b) -67<\/td><td>10111101 (8-bit two\u2019s complement integer)<\/td><\/tr><tr><td>c) -18.32<\/td><td>11101101.10110 (two\u2019s complement with fraction)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Explanation <\/h1>\n\n\n\n<p>Two\u2019s complement is the standard method to represent signed integers in binary form. Positive numbers are represented as straightforward binary, while negative numbers are represented by the two\u2019s complement of their absolute value. This method allows easy addition and subtraction in binary without separate sign handling.<\/p>\n\n\n\n<p>For integer parts, converting to binary is simple: divide the decimal number by 2 repeatedly and record remainders, or identify which powers of two sum to the number. For fractional parts, conversion uses repeated multiplication by 2, extracting the integer part of the result at each step until the fraction reaches zero or the desired precision is reached.<\/p>\n\n\n\n<p>For positive decimal numbers with fractions (like 127.375), we convert the integer and fractional parts separately, then combine them using a binary point.<\/p>\n\n\n\n<p>For negative numbers (like -67 and -18.32), we first convert the positive magnitude to binary. For integers, we decide the bit length (commonly 8, 16, or more bits) and convert to two\u2019s complement by inverting the bits and adding 1. For fractional numbers, the two\u2019s complement is computed by inverting all bits (including fractional bits) and adding one to the least significant fractional bit, considering the fractional precision.<\/p>\n\n\n\n<p>Note that representing fractions in binary often leads to approximations, as many decimal fractions do not have exact binary equivalents. The 5-digit precision after the decimal point represents a balance between accuracy and simplicity.<\/p>\n\n\n\n<p>In digital systems, two\u2019s complement enables efficient arithmetic operations and easy detection of overflow. The representation allows seamless use of positive and negative values, critical in computing, signal processing, and control systems.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/learnexams.com\/blog\/wp-content\/uploads\/2025\/05\/image-400.png\" alt=\"\" class=\"wp-image-218969\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>From decimal number To two complementary base.(you can write 5 digits after the comma)a) 127.375b) -67c) -18.32 The Correct Answer and Explanation is: Step 1: Understand the task a) 127.375 Step 2a: Convert integer part (127) to binary 127 in decimal to binary: 127 = 26+25+24+23+22+21+202^6 + 2^5 + 2^4 + 2^3 + 2^2 + [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","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":"","ast-disable-related-posts":"","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":[25],"tags":[],"class_list":["post-218968","post","type-post","status-publish","format-standard","hentry","category-exams-certification"],"_links":{"self":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts\/218968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/comments?post=218968"}],"version-history":[{"count":0,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts\/218968\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/media?parent=218968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/categories?post=218968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/tags?post=218968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}