avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] storing a float value to a 8-bit registers


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] storing a float value to a 8-bit registers
Date: Mon, 26 May 2003 10:29:17 +0200 (MET DST)

Abhijeet D Mhatre <address@hidden> wrote:

> Now if I want to store the float value back to the 8 bit registers
> how do I do that?

It's sheer impossible to (meaningfully) store a float in just 8 bits
only.  You have to divide the bits into those for the mantissa and for
the exponent.  So say, you use 4 bits for the exponent and 4 bits for
the mantissa, that would give you

1 bit for the sign of the exponent
3 bits for the exponent itself, i. e. a range of 0.125 through 8.0
  that can be represented without loss of precision
4 bits for the mantissa, i. e. you can differentiate 16 distinct values
  for each power of two

That range sounds pretty pointless to me.  In addition, you would have
to write your own set of conversion tools from standard (32-bit) to
your 8-bit float.

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]