delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/30/18:05:53

Date: Sat, 30 Aug 1997 17:04:07 -0500 (CDT)
Message-Id: <199708302204.RAA07816@ns.waller.net>
Mime-Version: 1.0
To: jnz1 AT aol DOT com (Jnz1)
From: Conrad Wei-Li Song <conradsong AT mail DOT utexas DOT edu>
Subject: Re: IEEE numbers
Cc: djgpp AT delorie DOT com

At 11:39 AM 8/27/97 GMT, you wrote:
>I recently learned the format of an IEEE float and I am still a bit
>confused.  I know all the exceptions like infinity, NaN, etc..., and i know
>how to get the exponent (E-127).  The one thing I don't get is how to
>actually get a decimal number from the mantissa.  For example, I read that
>6.5 (single precision) in binary is:
>0 10000001 10100000....
>S E             M
>
>I know E is 2, but what is the decimal equivilant of M?
>I need this because I'm writing a bunch of functions in DJGPP, and one of
>them is a printf-kinda function, and I will need to convert IEEE's to strings.
>
You need to prepend a 1 to the mantissa (always):

This you have
1.M * 2^(E-127)
1.101000... * 2^2
110.1 base-2
6.5 base-10

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019