I'm sorry, but I cannot see this as correct. Saving a 4 byte value in integer format then reading in the same 4 byte value and place it in an float variable performs no conversion. Conversion is needed due to how we want to interpret the type of data.
---------- Original Message ----------- From: hjherb...@web.de To: gambas-user@lists.sourceforge.net Sent: Sat, 13 Dec 2008 17:21:39 +0100 Subject: Re: [Gambas-user] Hex string to float > ... For 32 Float use the "Single" data type. > See http://gambasdoc.org/help/cat/datatypes > See http://gambasdoc.org/help/lang/type/single > > The example conversion may be done by this way: > > PUBLIC SUB DemoSingle() > DIM i AS Integer > DIM f AS Single > DIM hH AS File > > i = &h3fd55555& > OPEN "/tmp/hexfloat.tmp" FOR WRITE CREATE AS #hH > WRITE #hH, i > CLOSE #hH > OPEN "/tmp/hexfloat.tmp" FOR READ AS #hH > READ #hH, f > CLOSE #hH > PRINT "i=", i, "HEX", Hex$(i), " f=", f > END > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user ------- End of Original Message ------- ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user