[Gambas-user] ieee754

wally wally at ...2037...
Fri Dec 27 10:57:06 CET 2013


Hi,

i need to convert 4byte and 8byte HEX to single and float.
The following code works on gambas2 but seems to need modifications in Gambas3.
Any working example for Gambas3 available ?

Public Sub Button3_Click()
' i = &h3EAAAAAA& 'IEEE representation of 1/3

Dim i As Integer
Dim x As Single
Dim p As Pointer

    i = &h3EAAAAAA&

    p = Alloc(4)
    Write #p, i, 4		' << error *
    Read #p, x
    Free(p) 
   Print x

End


*  "Type mismatch: wanted Stream, got Pointer instead"

thx wally





More information about the User mailing list