floating point math results question

Steve Holden sholden at holdenweb.com
Sun Jan 27 10:11:48 EST 2002


"Peter Hansen" <peter at engcorp.com> wrote...
> phil hunt wrote:
> >
> > On Fri, 25 Jan 2002 16:01:50 GMT, Courageous <jkraska at san.rr.com> wrote:
> > >
> > >>The results should be 0.8 and that's it.
> > >
> > >First, this question is raised here often. Search
http://www.dejanews.com
> > >for detailed discussion on the matter.
> > >
> > >Second, as an academic exercise, you may now attempt to represent the
> > >number 0.8 as a 32 bit binary value. Summarize and we'll review. :-)
> >
> > I can do it in 24 binary bits:
> >
> > 00110000 00101110 00111000
>
> Naw, that was 26 ASCII characters.  The original "0.8" is 24 bits.
> I can do it in 16 bits:  ".8" !!  Fewer if you are willing to drop the
> leading binary zeros. <grin>

Well, I can do it in ONE bit, but only if you let me choose the Huffman
encoding.

regards
 Steve
--
Consulting, training, speaking: http://www.holdenweb.com/
Python Web Programming: http://pydish.holdenweb.com/pwp/








More information about the Python-list mailing list