Siao Posted May 29, 2007 Share Posted May 29, 2007 (edited) Or to be more specific, the actual converting between single precision float and its hex form... Unless I'm missing something in the documentation, for example, Binary(1.5) = 0x000000000000F83F, while I need 0x0000C03F and going the opposite way ( 0x0000C03F -> 1.5 ) with current built-in AutoIt commands doesn't seem possible at all (?) I've written functions to convert Float2Hex and Hex2Float working with strings - converting input to binary base and then converting that to output - following the steps of manual conversion; but those are rather klutzy, esp. Float2Hex... Is there a faster way of doing this? Edited May 29, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Toady Posted May 29, 2007 Share Posted May 29, 2007 Or to be more specific, the actual converting between single precision float and its hex form...Unless I'm missing something in the documentation,for example,Binary(1.5) = 0x000000000000F83F, while I need 0x0000C03Fand going the opposite way ( 0x0000C03F -> 1.5 ) with current built-in AutoIt commands doesn't seem possible at all (?)I've written functions to convert Float2Hex and Hex2Float working with strings - converting input to binary base and then converting that to output - following the steps of manual conversion;but those are rather klutzy, esp. Float2Hex...Is there a faster way of doing this?Can you please supply some code? www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
PaulIA Posted May 29, 2007 Share Posted May 29, 2007 Or to be more specific, the actual converting between single precision float and its hex form...Unless I'm missing something in the documentation,for example,Binary(1.5) = 0x000000000000F83F, while I need 0x0000C03Fand going the opposite way ( 0x0000C03F -> 1.5 ) with current built-in AutoIt commands doesn't seem possible at all (?)I've written functions to convert Float2Hex and Hex2Float working with strings - converting input to binary base and then converting that to output - following the steps of manual conversion;but those are rather klutzy, esp. Float2Hex...Is there a faster way of doing this?In the Auto3Lib A3LLibrary module, there are functions called _Lib_FloatToInt and _Lib_IntToFloat that convert a 4 byte float to/from a 4 byte int value. Simply use these and convert the output using the Hex function. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Siao Posted May 29, 2007 Author Share Posted May 29, 2007 In the Auto3Lib A3LLibrary module, there are functions called _Lib_FloatToInt and _Lib_IntToFloat that convert a 4 byte float to/from a 4 byte int value. Simply use these and convert the output using the Hex function.Whoa, using DllStruct...neat and ~100 times faster Thanks! "be smart, drink your wine" Link to comment Share on other sites More sharing options...
PaulIA Posted May 29, 2007 Share Posted May 29, 2007 Whoa, using DllStruct...neat and ~100 times faster Thanks!You're welcome. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now