Sign in to follow this  
Followers 0
n3250

AutoIt incorrectly count

5 posts in this topic

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

Share this post


Link to post
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

1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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
1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Big thanks guys!

You very help me :thumbsup:

Share this post


Link to post
Share on other sites

Glad to be of service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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
Sign in to follow this  
Followers 0