Linux Posted January 25, 2008 Share Posted January 25, 2008 if (4.02 - 4 <> 3.02 - 3) Then ConsoleWrite("4.02 - 4 = " & (4.02 - 4) ) I think it i dont need to say anything more. how can 4.02 - 4 <> 0.02? Post you comments. Respect, Linux @moderator, I couldn post this in bug section. if you fell like this belongs there, pls move it You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!" Link to comment Share on other sites More sharing options...
weaponx Posted January 25, 2008 Share Posted January 25, 2008 (edited) 4.02 - 4 is coming out as 0.0199999999999996 Edited January 25, 2008 by weaponx Link to comment Share on other sites More sharing options...
Linux Posted January 25, 2008 Author Share Posted January 25, 2008 4.02 - 4 is coming out as 0.0199999999999996Why? Shouln'd be 0.02? You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!" Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 25, 2008 Share Posted January 25, 2008 (edited) Why? Shouln'd be 0.02? It is, within the tolerance of a Double Word Floating Point number. You have the correct answer to within the tolerance of that number format. If it bothers you, round it to one less decimal place: $a = 4.02 - 4 ConsoleWrite("Debug: $a = " & $a & @LF) $a = Round($a, 14) ConsoleWrite("Debug: $a = " & $a & @LF) $b = 3.02 - 3 ConsoleWrite("Debug: $b = " & $b & @LF) Edited January 25, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
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