Posts

Showing posts with the label number system

mathajax

Binary to Real number conversion

The number system conversion is carried out for a binary numbers (base-2) into real number (base 10). The input binary bit sequence consists of integer and fraction binary bits separated by a decimal point. The integer bits and fractional bits are converted into decimal value separately and then combined to print real value as a result of given binary bit sequence. The fractional part of binary bits are converted into decimal fraction value by multiplication of the bits by 2 power of negative positional value of the bits. Binary to Real number Conversion - Manual Calculation Given input binary numbers = 1110.1001, converts it into a real number. separate binary bits into integer binary bits and fractional binary bits by a delimiter . (point) binary bits (integer part) = 1110 binary bits (fraction part) = 1001 Binary bits (integer part) into decimal conversion binary bits (integer part) ...

Real number to Binary conversion

The number system conversion is carried out for a real number to binary number bits. The input real number consists of integer and fraction values separated by a decimal point. The integer value and fractional value are converted into binary separately and then combined to print binary bits as a result of the real number. The fractional decimal number are converted into binary numbers by successive multiplication of the fraction by 2 and resulting string of integer digits is the converted binary numbers. Real number to Binary Conversion - Manual Calculation Given input real number= 14.125, convert it into binary numbers real = integer . fraction separate real into integer and fractional part decimal = 14 fraction = .125 Decimal value (integer) into Binary conversion 2 | 14 | 0 ----------- 2 | 7 | 1 ----------- 2 | 3 | 1 ----------- 1 deci...

Binary to Decimal & Decimal to Binary Bitwise Right-shift Operator

Image
The Java code has two number conversion operations; one is decimal to binary conversion and second binary to decimal conversion . These two operations are done by bitwise right shift operator .  Conditional switch selects the case, one of the two conversion operation is to carry out from choice input given to program.  If choice is 1, switch selects case1 ( binary to decimal conversion ) and if choice is 2, switch selects case2 ( decimal to binary conversion ). Decimal 2 Binary by Right shift  Binary to decimal conversion  Assume that, choice is 1 and switch selects binary to decimal conversion operation. The user is prompted enter 8 binary bits as input which is to be converted into a decimal value . Assume that, binary input given is 011000000 and it is stored into a string object “bstr” and initialize decval  = 0.   Bstr  =”[01100000]”   characters indexed (0,1,2,.)  from left to right  decval =0; the it...

Decimal to binary and Binary to decimal

The number system conversion process is carried out between base 10 and base 2 number system . The base 10 number system has 10 distinct numbers from 0 to 9 is called decimal number system and the base 2 number system has 2 distinct numbers 0 and 1 is binary number system . Decimal to binary (base 10 to base 2) conversion - algorithm Given a decimal value, decval and converts it into binary bits modulus decval by 2, it returns a reminder ( 0 or 1) divide decval by 2, it returns a quotient the quotient becomes the decval and repeat step 1 to 3 until decval becomes 0 the reminders on each iteration is results of binary bits Decimal to binary (base 10 to base 2) conversion - Example Given decimal value = 47 ,convert it into binary bits divide the decimal value by 2 returns a quotient and ...

Binary to Decimal Conversion

It is a number system conversion from binary to decimal number system that is carried out by arithmetic operation addition and a power function. Binary to Decimal conversion - steps Given binary 8 bits, converts it into decimal value set decval==0 Read a LSB bit from binary8bits IF LSB==1    add decval + 2 power of the LSB position value End IF Next LSB print decval binary to decimal value conversion - Example Given binary 8 bits = 10001111 ,convert it into a decimal value. The position value(0 to n-1 bits) starts right to left on the binary bits. 1000 1 1 1 1 | | | | |-----1 x 2^0 = 1 | | | |---------1 x 2^1 =2 | | |-------------1 x 2^2 =4 | | ----------------1 x 2^3 =8 | ...

Decimal to 8 bit binary conversion

The number system conversion from decimal into binary is carried out by arithmetic operators, modulus and divider. The conversion program has to be given a decimal value which must be in the range from 0 to 255 and it returns binary 8 bits as a result of the conversion. Decimal to binary 8 bits conversion - Steps Given a decimal value, decval and converts it into binary 8 bits modulus decval (the given decimal value) by 2, it returns a reminder ( 0 or 1) divide decval by 2, it returns a quotient the quotient becomes the decval and repeat step 1 to 3 for 8 times the reminders on each iteration is results binary 8 bits Decimal to binary 8 bits conversion - Example Given decimal value = 143 ,convert it into binary 8 bits divide the decimal value by 2 returns a quotient and reminder, ...