Jump to content

AutoIt incorrectly count


n3250
 Share

Recommended Posts

Hi all :bye:

Sorry for my bad english...I was meet problem, that's Autout count not correctly

$CountFrames = 0
$TargetX = 100
$UskX = 2.00
$UskNachX = $UskX*2
$UskNachX = $UskNachX - 0.04
While $CountFrames < 40
$CountFrames = $CountFrames + 1
$UskNachX = $UskNachX - 0.08
$TargetX = $TargetX - $UskNachX
IniWrite("log.ini", "log", $CountFrames, $UskNachX)
Wend

Let's see log.ini

[log]
1=3.88
2=3.8
3=3.72
4=3.64
5=3.56
6=3.48
7=3.4
8=3.32
9=3.24
10=3.16
11=3.08
12=3
13=2.92
14=2.84
15=2.76
16=2.68
17=2.6
18=2.52
19=2.44
20=2.36
21=2.28
22=2.2
23=2.12
24=2.04
25=1.96
26=1.88
27=1.8
28=1.72
29=1.64
30=1.56
31=1.48
32=1.4
33=1.32
34=1.24
35=1.16
36=1.08
37=0.999999999999997
38=0.919999999999997
39=0.839999999999998
40=0.759999999999998

0.999999999999997?? :wacko:

What's i do wrong?

I use latest version of Autoit 3.3.8.1

Link to comment
Share on other sites

Maybe you can use the Round() function, like this:

$UskNachX = Round($UskNachX - 0.08, 2)

Then you end up with this:

[log]

1=3.88

2=3.8

3=3.72

4=3.64

5=3.56

6=3.48

7=3.4

8=3.32

9=3.24

10=3.16

11=3.08

12=3

13=2.92

14=2.84

15=2.76

16=2.68

17=2.6

18=2.52

19=2.44

20=2.36

21=2.28

22=2.2

23=2.12

24=2.04

25=1.96

26=1.88

27=1.8

28=1.72

29=1.64

30=1.56

31=1.48

32=1.4

33=1.32

34=1.24

35=1.16

36=1.08

37=1

38=0.92

39=0.84

40=0.76

Link to comment
Share on other sites

That's because numbers are stored and processed in binary format. Converting from 10-based format to 2-based leads to inaccuracy.

Please search the forum - it has beend discussed a few weeks ago.

Edit: Found it. Check this

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Glad to be of service :D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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