| View previous topic :: View next topic |
| Author |
Message |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Thu Jan 01, 2009 3:38 pm Post subject: |
|
|
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-1.0.48-BIN-new2.zip (240 KB) (BIN file for making compiled scripts) |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Thu Jan 01, 2009 4:31 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Thu Jan 01, 2009 4:43 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
KalleW
Joined: 09 Jun 2005 Posts: 31 Location: Germany near Cologne
|
Posted: Tue Jan 06, 2009 11:09 am Post subject: Problem and comment on: Setformat Float, xxx |
|
|
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. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Tue Jan 06, 2009 1:11 pm Post subject: Re: Problem and comment on: Setformat Float, xxx |
|
|
| 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. |
|
| Back to top |
|
 |
KalleW
Joined: 09 Jun 2005 Posts: 31 Location: Germany near Cologne
|
Posted: Tue Jan 06, 2009 1:42 pm Post subject: Re: Problem and comment on: Setformat Float, xxx |
|
|
| 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 Tue Jan 06, 2009 2:33 pm; edited 1 time in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Tue Jan 06, 2009 2:13 pm Post subject: |
|
|
| To avoid code bloat, AutoHotkey currently uses the Windows API for date/time math. Hopefully it is just as accurate as the library above. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Tue Jan 06, 2009 3:49 pm Post subject: |
|
|
| Chris wrote: | | Hopefully it is just as accurate as the library above. |
It is AHK lib..  _________________ URLGet - Internet Explorer based Downloader |
|
| Back to top |
|
 |
Tahattmeruh Guest
|
Posted: Tue Jan 06, 2009 9:37 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Wed Jan 07, 2009 1:03 am Post subject: |
|
|
| No changes were made to those parts of the program. So it could just be a timing issue or some OS quirk. |
|
| Back to top |
|
 |
BenCh Guest
|
Posted: Thu Jan 22, 2009 12:32 pm Post subject: Problem with NoDecompile |
|
|
| 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"...) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Thu Jan 22, 2009 7:02 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
BenCh Guest
|
Posted: Fri Jan 23, 2009 12:42 pm Post subject: |
|
|
| Thank-you, that fixed it. |
|
| Back to top |
|
 |
IanH1960
Joined: 10 Apr 2007 Posts: 8
|
Posted: Sat Jan 31, 2009 5:59 pm Post subject: Different uncompiled and compiled behaviours |
|
|
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 |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Sun Feb 01, 2009 2:55 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|