JohnWIlling Posted July 10, 2017 Posted July 10, 2017 Trying to do some math with 64 bit and noticed math was not coming out right. Local $tDec = DllStructCreate("int64 num") $tDec.num = 0xDEADBEDDEADBED ConsoleWrite('Before:' & $tDec.num & @CRLF); $tDec.num = $tDec.num / 1 ConsoleWrite(' After:' & $tDec.num & @CRLF); This is generating: Before:62678480108313581 After:62678480108313585 Am I missing something? If I replace the divide ("/") with Multiply ("*") it works but the divides do not. If I divide by 2, I get: Local $tDec = DllStructCreate("int64 num") $tDec.num = 0xDEADBEDDEADBED ConsoleWrite('Before:' & $tDec.num & @CRLF); $tDec.num = $tDec.num / 2 ConsoleWrite(' After:' & $tDec.num & @CRLF); Before:62678480108313581 After:31339240054156793 But the number should be: 31339240054156790 Running with 32 bit AutoIT 3.3.14.2
jchd Posted July 10, 2017 Posted July 10, 2017 In AutoIt / always yields a floating-point value, hence inexact. This modified code demonstrates this: Local $iDec = 0xDEADBEDDEADBED ConsoleWrite('Before:' & $iDec & @CRLF); $iDec = $iDec / 1 ConsoleWrite(' After:' & $iDec & @CRLF); There is unfortunately no integer divide built in. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
JohnWIlling Posted July 11, 2017 Author Posted July 11, 2017 So is there another method to do this? Do you know of a routine in msvcrt.dll or KERNEL.dll that can do division with longs?
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