NTT123 Posted March 16, 2009 Posted March 16, 2009 (edited) Hi, First example ------------------------------------------------------------------------------------------------------------------ dim $a,$b,$c $a=1.00045 $b=1.00021 $c=$a-$b run("notepad.exe") WinActivate('Untitled - Notepad') WinWaitActive('Untitled - Notepad') send("$c=") send($c) ------------------------------------------------------------------------------------------------------------- Output $c= 0.000240000000000018 wtf, why not 0.00024 Second example ------------------------------------------------------------------------------------------------------- dim $c $c=987654321.123456789 run("notepad.exe") WinActivate('Untitled - Notepad') WinWaitActive('Untitled - Notepad') send("$c=") send($c) --------------------------------------------------------------------------------------------------------------- Output $c=987654321.123457 , why not 987654321.123456789 Do you know how to fix this? Edited March 16, 2009 by NTT123
jvanegmond Posted March 16, 2009 Posted March 16, 2009 Hi. Floating point maths problems. AutoIt can't solve this. Same problem in C++, C#, VB, etcetera. github.com/jvanegmond
NTT123 Posted March 16, 2009 Author Posted March 16, 2009 Thx Managar. Seems all my programs must not have any floating points. Its sad.
Richard Robertson Posted March 16, 2009 Posted March 16, 2009 You can use floating points. You just have to deal with the fact that floating point numbers will have some issues. There are a number of interesting things about floating point values.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now