Jump to content
Sign in to follow this  
RichardL

Convert 64-bit IEEE float values from WinPCap data

Recommended Posts

RichardL

I've been using WinPCap and examples on the forum list data from packets. For 32-bit IEEE floats I can see the values with this:

$x = 0x0b634b40
ConsoleWrite(StringFormat("%8.8x %10.2f\n", $x, _WinAPI_IntToFloat('0x' & SwapEndian($x))))
0b634b40         3.18

Now I need to process 64-bit IEEE floats, so need a 64-bit equivalent of _WinAPI_IntToFloat. I don't mind losing the extra precision, the results will be rounded to 4 significant decimal digits at the most. Can't find anything on the forum. Does anyone use 64-bit floats? I think this is the first time I've ever seen a system using them.

e.g. 407e21c4e0000000 = 482.1105651855469

Is _WinAPI_IntToFloat a wrapper around a Windows function? and there's a 64-bit equivalent that I can get to with DllCall.

Is the AutoIt float an IEEE 32-bit float inside a variant?

If there's nothing better I'm thinking of:

- using bit operations to build a 32-bit number discarding all the extra bits.

- writing a dll in C to do the conversions and return the result (exactly what type?) to AutoIt.

Any info appreciated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×