floating point math results question

Peter Hansen peter at engcorp.com
Sat Jan 26 13:43:53 EST 2002


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>



More information about the Python-list mailing list