[Gambas-user] R: ieee754
Ru Vuott
vuott at ...325...
Fri Dec 27 12:31:10 CET 2013
Using Memory Stream:
Public Sub Main()
' i = &h3EAAAAAA& 'IEEE representation of 1/3
Dim i As Integer
Dim x As Single
Dim p As Pointer
Dim s As Stream
i = &h3EAAAAAA&
p = Alloc(4)
s = Memory p For Write
Write #s, i As Integer
Read #s, x
Print x
Free(p)
End
--------------------------------------------
Ven 27/12/13, wally <wally at ...2037...> ha scritto:
Oggetto: [Gambas-user] ieee754
A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
Data: Venerdì 27 dicembre 2013, 10:57
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
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your
business. Most IT
organizations don't have a clear picture of how application
performance
affects their revenue. With AppDynamics, you get 100%
visibility into your
Java,.NET, & PHP application. Start your 15-day FREE
TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list