[Solved] how does floating point numbers get stored in memory [closed]


As far as I know flaoting numbers(for single precision) are stored in memory as follows:

  • sign s (denoting whether it’s positive or negative) – 1 bit
  • mantissa m (essentially the digits of your number – 24 bits
  • exponent e – 8 bits

For example:

3.14159 would be represented like this:

0 10000100 11001001000011111100111
    ^     ^               ^
    |     |               |
    |     |               +--- significand = 0.7853975
    |     |
    |     +------------------- exponent = 4
    |
    +------------------------- sign = 0 (positive)

Do note that . is not stored at all in memory.

As a good reference read What Every Computer Scientist Should Know About Floating-Point Arithmetic and Floating Point

11

solved how does floating point numbers get stored in memory [closed]