Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Little Math bug?

$
0
0

Hello everyone,

 

I have a little logical question about basic math with AutoIT. I did caunting a little bit and somehow my program giveing me back wrong number all the time. I start searching for the problem and run step by step till i found out this:

Local $Number = 19.2 If $Number > 0 Then Do   $Number = $Number - 1 Until $Number < 1 EndIf MsgBox(0, "", $Number)

This should give me back 0.2 but somehow it giveing as resoult 0.199999999999999 and it is not accurate. Any idea how it is posible? It is totaly unlogic for me. I do not know why it is not accurate, but if i write only this: 1.2 - 1 It give the right resoult (0.2). If it is some kinda bug, then can anyone help to me, how i can get the 0.2 out from $number? Cause i need only the decimal number. I use the integer part for other calculation.

 

$Number is a dynmic number, but in example i use a fix number cause it is easyer.


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>