From: Roberto R. <rob...@ar...> - 2003-11-11 06:44:09
|
Thanks a lot, Peter & Duncan. union work great ! Roberto Ricardi wrote: > Hi all, > > I got a float single, manage it in a binary form in an unsigned int. > And wish to recover the float form. > The magnitudes range never be greather than +/- 32k. > > to manage a float we can do: Sign * 2^m * 1.F ( where m = E -127 and > F = mantissa). > > To reconstruc with: > > r = 0.0 /* this is float */ > n = Mantisa /* unsigned, mantissa constructed in binary */ > n = n | 0x3F800000; /* this meant 'or' with E-127 = 0, positive */ > > now try to 'or' the binary equiv. in the float variable > > r = r | n; /* meant 1.F */ > > compiler cant manage float and unsigned 'or', maybe assuming not both > 32 bits long ? > the next cant be managed too, of course: > > r = 2^m * r; /* meant 2^m * 1.F */ > > How can I construct a float from a binary unsigned equiv. value ? > > Thanks a lot in advance > > Rob > > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: ApacheCon 2003, > 16-19 November in Las Vegas. Learn firsthand the latest > developments in Apache, PHP, Perl, XML, Java, MySQL, > WebDAV, and more! http://www.apachecon.com/ > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > > |