Opened 15 years ago

Closed 15 years ago

#502 closed Bug (No Bug)

Autoit adds 0.09999999997 instead of 0.01

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: Blocking
Keywords: count Cc:


After adding 0.01 to $c few times, $c will be incremented by 0.999999 instead of 0.01

$c = 0
$inc = 0.01

 $c += $inc
Until $c > 14
ConsoleWrite('$c = ' & $c & @crlf)


+>14:50:40 AU3Check ended.rc:0
>Running:(\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\shithole\Desktop\bug.au3"    
$c = 14.0099999999997
+>14:50:41 AutoIT3.exe ended.rc:0

Windows XP SP3
AutoIt V3.2.12.1

Best regards

Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by rbhkamal

I'm rbhkamal... not anonymous

comment:2 Changed 15 years ago by Valik

  • Resolution set to No Bug
  • Status changed from new to closed

This is not a bug. Floating-point numbers are not precise so repeatedly adding a floating point number leads to these sorts of problems. You can find plenty of literature on the internet about it.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.