AutoHotkey Community

It is currently May 26th, 2012, 1:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Author Message
 Post subject:
PostPosted: January 1st, 2009, 4:38 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks to Lexikos, the release has been fixed so that bitwise operations involving floating point variables don't wrongly cache those variables as integers. Without the correction, the following example shows "2" instead of the expected "3.000000":
Code:
b := 1.5
a := b ^ 1
MsgBox % b * 2

The topmost post has been updated with the following links:
www.autohotkey.com/misc/AutoHotkey-Pre-1.0.48-new3.exe (238 KB)
www.autohotkey.com/misc/AutoHotkey-Pre- ... N-new2.zip (240 KB) (BIN file for making compiled scripts)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2009, 5:31 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
The link still points to the old AutoHotkeySC.bin, w/o the bugfix, so compiled scripts still show 2 intead of 3.000000 with the test script. In the first post there are two links to the bin file, which needed update.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2009, 5:43 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks. I've fixed the BIN/compiler ZIP file to contain the new version instead of the old one. All the old links (in case anyone has saved them or they appear elsewhere in the topic) also contain the newest versions.


Top
 Profile  
Reply with quote  
PostPosted: January 6th, 2009, 12:09 pm 
Offline

Joined: June 9th, 2005, 8:27 am
Posts: 31
Location: Germany near Cologne
Hi Chris,

really great the idea of storing the real number as binary (Real*8 = Double = precision 15 decimal digits) and not as a string and thanks for your work.

I was waiting for that: Date + time calculation starting in 1582 needs 14 digits for msec precision. Used "SetFormat Float 0.16E" before.

Chris wrote:
thinking of adding a new mode such as SetFormat, FloatFast, 0.6 that would leave caching enabled


May be it could be better to have a conversion routine instead of a format statement that only works on direct output (e.g. Msgbox) like
Code:
var := 81.123456789
string := ConvDecimal( %var%, 0.2 ) " Dollar"

which could be used in composing out-string too.


Top
 Profile  
Reply with quote  
PostPosted: January 6th, 2009, 2:11 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
KalleW wrote:
May be it could be better to have a conversion routine instead of a format statement that only works on direct output (e.g. Msgbox) like
Code:
var := 81.123456789
string := ConvDecimal( %var%, 0.2 ) " Dollar"

which could be used in composing out-string too.
That is good, though it would take a while to research and design something that's flexible yet intuitive. By contrast, extending SetFormat is almost trivial and would require minimal changes to any existing scripts that need maximize performance.

I expect your idea will be implemented in some future version, especially a major version like v2 that is expected to have more functions and fewer commands. Perhaps more things like FormatTime could be added after researching other languages for the best syntax. It would also be good to have some date/time functions to provide a more intuitive way to compare and manipulate dates and times.

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: January 6th, 2009, 2:42 pm 
Offline

Joined: June 9th, 2005, 8:27 am
Posts: 31
Location: Germany near Cologne
Chris wrote:
It would also be good to have some date/time functions to provide a more intuitive way to compare and manipulate dates and times.


Here they are:
http://sourceforge.net/projects/datetimelib/

In short:

Library routines for computation of date and time functions since the Gregorian Calendar was introduced on 1582-Oct-15:

- add/subtract days&hh:mm:ss to/from a given date&time
- with variables type Double: exact calculations down to 0.001 sec (1 msec)
- considered all leap years (the anormalities every 4, 100 and 400 years)
- considered the changes from summer time (Daylight Saving Time DST) to winter time and back
- compute the start and end dates of DST for a given year
- compute UTC (Universal Time = Greenwich Time) to local time; considered DST
- compute weekdays
- convert to Excel compatible date/time values
- template for your own implementation
- documentation inside the routines and in a handbook


Last edited by KalleW on January 6th, 2009, 3:33 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2009, 3:13 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
To avoid code bloat, AutoHotkey currently uses the Windows API for date/time math. Hopefully it is just as accurate as the library above.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2009, 4:49 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Chris wrote:
Hopefully it is just as accurate as the library above.


It is AHK lib.. :roll:

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2009, 10:37 pm 
I have a small hotkey to start a new empty notepad.

;New Notepad
^!n::Run notepad.exe

But since the new beta version, I always starts in the background and I have to click on the taskbar icon.
With the previous version, I was the topmost program


Top
  
Reply with quote  
 Post subject:
PostPosted: January 7th, 2009, 2:03 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
No changes were made to those parts of the program. So it could just be a timing issue or some OS quirk.


Top
 Profile  
Reply with quote  
 Post subject: Problem with NoDecompile
PostPosted: January 22nd, 2009, 1:32 pm 
What am I doing wrong? I can't get scripts to compile successfully using the NoDecompile switch. Are you sure the version in the zip file is the right one? (After all, the zip file says "new2" not "new3"...)


Top
  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2009, 8:02 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I've successfully tested the NoDecompile switch with this version. So perhaps your version of Ahk2Exe is too old. Try replacing it with the following: www.autohotkey.com/misc/Ahk2Exe-1.0.47.06.zip


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2009, 1:42 pm 
Thank-you, that fixed it.


Top
  
Reply with quote  
PostPosted: January 31st, 2009, 6:59 pm 
Offline

Joined: April 10th, 2007, 10:17 am
Posts: 8
Have been checking the beta on some scripts and am indeed seeing faster performance.

One strange behaviour on same script between its uncompiled and compiled forms. I'm fairly sure I'm using the beta AHK .exe and the beta AHK SC.bin in the Compiler directory.

It's the effect of "SetFormat, integer". Here's a code snippet

Code:
int1 := 100

MsgBox int1 decimal: %int1%

SetFormat, integer, hex
  int1 += 0
SetFormat, integer, d

MsgBox int1 hex: %int1%


If I run this by double clicking the .ahk the second MsgBox reports int1 as "0x64" as expected.

If I compile the script then run the .exe the 2nd MsgBox reports int1 as "100"

I can get the compiled version to report "0x64" by removing the second SetFormat statement.

Would appreciate if anyone could just check this. Should I be doing anything other than installing the AHK beta .exe in the AHK directory and the beta ..SC.bin in the Compiler subdirectory?

This is significant as I use this method to prepare a hex string for writing to a COM port.

Many thanks

Ian


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 1st, 2009, 3:55 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
AutoHotkey_L (my custom build) has been updated with bug-fixes and optimizations from the current beta, a fix for the bug reported by Ian, and one new feature.

Chris, the section of code which disables binary number write-caching was omitted from SC builds, along with load-time validation of SetFormat's parameters.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group