[Gambas-user] R: ieee754
wally
wally at ...2037...
Fri Dec 27 13:09:48 CET 2013
Thank You !
but result is "1.261169E-44"
expected "3.33333E-1"
3.33333313465118408203125E-1
On Friday 27 December 2013 11:31:10 Ru Vuott wrote:
> 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
>
>
> ----------------------------------------------------------------------------
> -- 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