How does a computer store decimal point values?

binary, computer-science, cpu-architecture, hex

Solution

For your first point, see the IEEE754-1985 Wikipedia page for one approach (probably the most common).

For your second point, you need to realise that there is a disconnect between a value and the representation of that value. A value can be stored in one way and interpreted in a host of different ways.

For example, the octets `0x30, 0x31` may be represented as the value `0x3031` in big-endian 16-bit values, `0x3130` in little-endian or the character sequence `'0', '1'` in ASCII. It would be something else again if it was treated as EBCDIC or fixed point values.

It all comes down to how you interpret the data.

Problem

I have a few questions: Computers only use 1s and 0s to represent numbers. Then how does it represent a decimal point like 5.512. The computer doesn't know whether we are entering an ASCII value or just a random binary for it to process. In earlier days, people used to program using hex and binary. How would they achieve in outputting a character on the screen. Apart from that how does the computer understand that 65(decimal) is not a number but a capital A?

Original source