[Gambas-user] Hex string to float

hjherbert at ...20... hjherbert at ...20...
Sat Dec 13 17:21:39 CET 2008


... 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




More information about the User mailing list