answersLogoWhite

0


Best Answer

This is the Binary32 format from IEEE-754-2008.

To convert a decimal to binary real start by checking for zero. If so, the answer is all zeroes. Then record the sign and make the number positive. Then create an exponent with an initial value of 127. Iteratively multiply or divide the number by two, while decrementing or incrementing the exponent, until the number is greater than or equal to 1, and less than 2. Throw away the high order bit, by subtracting one from the number, as it will always be one, and we can imply it in the result. Multiply the number by 223, and add 0.5, to construct a rounded integer mantissa of 23 bits in length. Assemble the sign bit, 8 bit exponent, and 23 bit mantissa together. Note that exponents of 255 and 0 are special and are interpreted differently, so the proper range of exponent is 1 to 254.

For more information, please see the Related Link below.

For more information of other formats covered under the specification, please see the second Related Link below.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you convert decimal to binary of real values?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is B tree a Binary Search Tree?

Yes because there is no real practical use for a binary tree other than something to teach in computer science classes. A binary tree is not used in the real world, a "B tree" is.


How many bytes are in a binary code?

There is no real answer to this. Binary codes can be any length. The minimum length is 1 byte.


What is meant by ones-compliment of a decimal number?

One-complement applies to binary values, not decimal values. Therefore when we say the ones-complement of a decimal value we mean convert the value to binary, invert all the bits (the ones-complement), then convert the result back to decimal. For example, the decimal value 42 has the following representation in 8-bit binary: 00101010 If we invert all the bits we get 11010101 which is 213 decimal. Thus 213 is the ones-complement of 42, and vice versa. However, it's not quite as straightforward as that because some (older) systems use ones-complement notation to represent signed values, such that 11010101 represents the decimal value -42. The problem with this notation is that the ones-complement of 00000000 is 11111111 which means the decimal value 0 has two representations, +0 and -0 respectively. In the real-world, zero is neither positive nor negative. To resolve this problem, modern systems use twos-complement to represent signed values. The twos-complement of any value is simply the ones-complement plus one. Thus the ones-complement of 42 becomes -43, therefore the twos-complement of 42 is -43+1 which is -42. Thus -42 is represented by the binary value 11010110 in twos-complement notation. With twos-complement, there is only one representation for the value 0. This is because the ones-complement of 00000000 is 11111111 and if we add 00000001 we get 00000000. Note that we don't get 100000000 because the result cannot have any more bits than were in the original value. When an "overflow" occurs, we cycle back to zero. As a result, incrementing and decrementing signed values has exactly the same logic as incrementing or decrementing unsigned values and flipping the sign of any value is only slightly more complicated by the extra addition operation. However, flipping the sign of a value is a much rarer operation than counting so the cost is trivial compared to the cost of counting operations using ones-complement (because there are two values for zero). Note that ones-complement notation allows an 8-bit value to store signed values in the range -127 to +127, whereas twos-complement allows a range of -128 to +127 (through the elimination of the extra zero). But in unsigned notation, both allow the same range: 0 to 255. Although we rarely encounter ones-complement notation, it is important to keep in mind that not all systems use twos-complement notation, particularly when working with low-level but portable programming languages. This is the reason why both the C and the C++ standards state that the range of an 8-bit signed value is only guaranteed to store values in the range -127 to +127.


Conversion of decimal to binary in fortran?

This is not a perfect program, but it will get you started in the right direction. Works for any INTEGER up to "some" power of 2 (decimals kill the program). PROGRAM binary IMPLICIT NONE INTEGER remainder, quotient, n, int_input, answer REAL input, dec_input WRITE(*,*) 'Input a number to convert to binary' READ(*,*) input int_input = input dec_input = input - int_input dec_input = abs(dec_input) quotient = abs(input) DO WHILE (dec_input==0) n = 0 answer = 0 DO WHILE (quotient>1) remainder = mod(quotient,2) quotient = quotient/2 answer = answer+remainder*10.**n n = n+1 END DO IF (input<0) answer = -answer answer = answer + quotient*10.**n WRITE(*,"(a,i31)") 'Your answer in binary is:',answer END DO END PROGRAM binary


What is the binary code used for?

binary code(computer science) A code in which each allowable position has one of two possible states, commonly 0 and 1; the binary number system is one of many binary codes.Source: http://www.answers.com/binary+code?cat=technology

Related questions

How are real numbers expressed in binary?

The same as real numbers are expressed in decimal, except only the digits 0 and 1 are used (instead of 0 to 9) and the separator between the integer and fraction part is called the binary point (instead of the decimal point). The sign if needed is the same as in decimal.


What is the same thing as 10101010?

The binary number 10101010 is equivalent, in decimal representation, to 128 + 32 + 8 + 2 = 170. But this answer assumes that the given number is binary - an assumption for which there is no real justification. Besides, the relationship is an equivalence, which is not quite "the same thing".


What number is irrational?

An irrational number is a real number that cannot be expressed as a ratio of two integers. In decimal terms, it is a real number that has either a terminating decimal or an infinitely recurring decimal. This would apply whatever the integer base, such as binary, octal, hexadecimal.


What is commutative property of addition using decimal numbers?

The commutative property of addition applies to all real and complex numbers. It has nothing whatsoever to do with the form in which the number is represented: decimal, binary, etc.


What is the difference between real income and money income?

In economics, the nominal values of something are its money values in different years. Real values adjust for differences in the price level in those years. Examples include a bundle of commodities, such as Gross Domestic Product, and income. For a series of nominal values in successive years, different values could be because of differences in the price level. But nominal values do not specify how much of the difference is from changes in the price level. Real values remove this ambiguity. Real values convert the nominal values as if prices were constant in each year of the series. Any differences in real values are then attributed to differences in quantities of the bundle or differences in the amount of goods that the money incomes could buy in each year....


What are the possible values of 8.9 kg?

Assuming that this question has to do with rounding, and that there is no zero-error, the answer: is any real value in the range (8.85, 8.95).Assuming the measurement is accurate to 1 decimal place, the range of possible values is (8.85, 8.95).


What is a real world example for a binary tree?

A binary tree is simply a way to create a flow chart for decisions. An example of a real life binary tree is anything that requires a series of yes or no answers.


Can you do pi to the millionth decimal?

I don't want to try. Pi has been calculated to far higher values than a million decimal places. However more than about forty places have no practical use in the real universe.


Difference between single precision and double precision?

Single Precision, called "float" in the 'C' language family, and "real" or "real*4" in Fortan. This is a binary format that occupies 32 bits (4 bytes) and its significand has a precision of 24 bits (about 7 decimal digits). Double Precision called "double" in the C language family, and "double precision" or "real*8" in Fortran. This is a binary format that occupies 64 bits (8 bytes) and its significand has a precision of 53 bits (about 16 decimal digits). Regards, Prabhat Mishra


Is B tree a Binary Search Tree?

Yes because there is no real practical use for a binary tree other than something to teach in computer science classes. A binary tree is not used in the real world, a "B tree" is.


How many bytes are in a binary code?

There is no real answer to this. Binary codes can be any length. The minimum length is 1 byte.


What is meant by ones-compliment of a decimal number?

One-complement applies to binary values, not decimal values. Therefore when we say the ones-complement of a decimal value we mean convert the value to binary, invert all the bits (the ones-complement), then convert the result back to decimal. For example, the decimal value 42 has the following representation in 8-bit binary: 00101010 If we invert all the bits we get 11010101 which is 213 decimal. Thus 213 is the ones-complement of 42, and vice versa. However, it's not quite as straightforward as that because some (older) systems use ones-complement notation to represent signed values, such that 11010101 represents the decimal value -42. The problem with this notation is that the ones-complement of 00000000 is 11111111 which means the decimal value 0 has two representations, +0 and -0 respectively. In the real-world, zero is neither positive nor negative. To resolve this problem, modern systems use twos-complement to represent signed values. The twos-complement of any value is simply the ones-complement plus one. Thus the ones-complement of 42 becomes -43, therefore the twos-complement of 42 is -43+1 which is -42. Thus -42 is represented by the binary value 11010110 in twos-complement notation. With twos-complement, there is only one representation for the value 0. This is because the ones-complement of 00000000 is 11111111 and if we add 00000001 we get 00000000. Note that we don't get 100000000 because the result cannot have any more bits than were in the original value. When an "overflow" occurs, we cycle back to zero. As a result, incrementing and decrementing signed values has exactly the same logic as incrementing or decrementing unsigned values and flipping the sign of any value is only slightly more complicated by the extra addition operation. However, flipping the sign of a value is a much rarer operation than counting so the cost is trivial compared to the cost of counting operations using ones-complement (because there are two values for zero). Note that ones-complement notation allows an 8-bit value to store signed values in the range -127 to +127, whereas twos-complement allows a range of -128 to +127 (through the elimination of the extra zero). But in unsigned notation, both allow the same range: 0 to 255. Although we rarely encounter ones-complement notation, it is important to keep in mind that not all systems use twos-complement notation, particularly when working with low-level but portable programming languages. This is the reason why both the C and the C++ standards state that the range of an 8-bit signed value is only guaranteed to store values in the range -127 to +127.