JohnWIlling

int64 issue

3 posts in this topic

#1 ·  Posted


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

Share this post


Link to post
Share on other sites



#2 ·  Posted

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 here
RegExp tutorial: enough to get started
PCRE 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)

Share this post


Link to post
Share on other sites

#3 ·  Posted

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?

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