Jump to content

Odd Math Results


Lucid
 Share

Recommended Posts

I'm hoping someone can shed some light on something for me...

I've got a larger block of code that is hiccupping, and I narrowed it down to what seems to be an offending piece of math.

If I compile the following code for x64, and I run it under 64-bit Windows PE, it works just fine on a Dell OptiPlex 980. However, if I boot up into the exact same 64-bit Windows PE environment on a new Dell OptiPlex 7020, it causes an illegal exception. What gives? Is there some sort of hardware, RAM, or BIOS setting that makes the math not work out, or spit out some odd integer that the message box can't handle or something? I'm weak on high level math, so maybe I'm overlooking something obvious?

Can anyone help shed some light on this?

Thanks!

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=Test.exe
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Global $iHigh = 669650608 * 2 ^ 32
MsgBox(64, "testing", $iHigh)

I'm using Autoit 3.3.14.2 with SciTE 3.6.0

Link to comment
Share on other sites

The error message that pops up is:

 

TITLE: AutoIt v3: Test.exe - Application Error

MESSAGE: The exception Illegal Instruction
An attempt was made to execute an illegal instruction.
(0xc000001d) occurred in the application at location 0x00007FF6CE279FD1.

Click OK to terminate the program

Link to comment
Share on other sites

I fail to understand this. It's not possible for me to reproduce your error for two reasons. Firstly you haven't provided the code which causes this problem (or is the message box code you posted not working when compiled and exported to a new system - I'm confused). Secondly I don't have two Dell Optiplex 7020's available to test it. However it is plausible that the discrepancy is caused by a Windows bug.

You seem to have narrowed down the problem to a numeric expression, but that might not be the issue. I didn't see a problem with the expression you provided, which returns 2876127461106515968. You might want to take a look at operator64 in my signature: which may provide a little insight, but then again it might not. There are some inconsistencies occurring when using standard operators, especially with large integers (ODD MATH RESULTS). Please be aware that the functions in operator64 are a lot slower than standard operators, so they should only be used sparingly. If you get an unexpected result from a mathematical expression - it might be worth testing the same expression using the UDF functions to see if there is a difference.

I'm still doubtful that this is a maths error - you haven't given enough details. The code you posted works fine on my machine.

Edited by czardas
more detail
Link to comment
Share on other sites

czardas, the code in my first post IS the code that causes the error.

And yes, I know it's aggravating and seems odd that it blows up - it works on one machine, but not another.

I went back and did more tests and think this is some sort of bug with using Autoit 3.3.14.2 with SciTE 3.6.0. If I compile that same code from my first post using AutoIt 3.3.12.0 with SciTE 3.4.4 it works just fine with no errors.

Link to comment
Share on other sites

I'm using AutoIt 3.3.14.2 with Scite4AutoIT 3.6.0 on Windows 10 Pro and your little script works as expected when run from Scite or compiled to exe and run, both as 32bit and 64bit.

 

 

test.png

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

I can change the value and such just fine. And the code works just fine on one test machine running Windows PE (and my older code has run on several hundred instances of Windows PE without a hiccup). It just seems to blow up on another, newer test PC running the exact same 64-bit Windows PE environment (32-bit seems to be just fine on both machines).

If I compile with an older version of Autoit, it works just fine on both machines. So just getting a success on a single machine isn't an indicator that the x64 compiled code is working. Sorry, all I can say is that to me, this seems to point at either the hardware or Autoit as being the culprit. I'm functioning fine after dropping back to the older Autoit, so I just wanted to share the above for anyone else experiencing weirdness too. And if anyone has any ideas they want me to try, I'm happy to do so.

Link to comment
Share on other sites

It points at hardware to me, because it works on one but not another it's not AutoIt. If it failed across all machines then it might be AutoIt.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 2 months later...

just wanted to report that I am experiencing the same issue in WinPE x64 environment and only appears when compiled  Autoit 3.3.14. If i go back to  AutoIt 3.3.12.0  the script works perfect.  So something changed in the version that is preventing it to run in this environment.  My workaround for now is to use AutoIt 3.3.12.0 to compile these type of scripts (which is minimal for me).

MESSAGE: The exception Illegal Instruction
An attempt was made to execute an illegal instruction.
(0xc000001d) occurred in the application at location 0x00007FF6CE279FD1.

Click OK to terminate the program

Link to comment
Share on other sites

AFAIK WinPE isn't in the list of supported OSes of  AutoIt.

And I seem to recall that a change of the (internal) math library was necessary to fix issues with the library previously in use, but after thinking at that again this might be predating 3.3.12.0. OTOH the issue might very well be the consequence of a change of compiler (or compile options) used to produce the AutoIt code interpreter.

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)

Link to comment
Share on other sites

  • 1 year later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...