ForexGG Posted June 8, 2009 Share Posted June 8, 2009 $QUOTE_END = 161.10 $QUOTE_STA = 161.05 $QUOTE_END -= 0.05 MsgBox(0,"",$QUOTE_END & " " & $QUOTE_STA,2) MsgBox(0,"",$QUOTE_END >= $QUOTE_STA,2) isn't 161.05>=161.05? why it gives false instead of ture? thanks Link to comment Share on other sites More sharing options...
Inverted Posted June 8, 2009 Share Posted June 8, 2009 Even just = doesn't work. I guess it's some weirdness with how AutoIt habndles floating numbers, Rounding them works fine : $QUOTE_END = 161.10 $QUOTE_STA = 161.05 $QUOTE_END -= 0.05 MsgBox(0,"",Round($QUOTE_END,2) & " " & $QUOTE_STA) MsgBox(0,"",Round($QUOTE_END,2) >= $QUOTE_STA) Link to comment Share on other sites More sharing options...
picaxe Posted June 8, 2009 Share Posted June 8, 2009 (edited) Try rounding to 2 decimal places. MsgBox(0,"",Round($QUOTE_END,2) >= Round($QUOTE_STA,2),2) Edited June 8, 2009 by picaxe Link to comment Share on other sites More sharing options...
ForexGG Posted June 8, 2009 Author Share Posted June 8, 2009 thanks must be a bug in Autoit Link to comment Share on other sites More sharing options...
picaxe Posted June 8, 2009 Share Posted June 8, 2009 (edited) thanks must be a bug in AutoitIt's not AutoIt, it's floating point precision. There many threads on these forums discussing this issue. Edited June 8, 2009 by picaxe Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 8, 2009 Share Posted June 8, 2009 thanks must be a bug in AutoitThis is a standard behavior of floating point math on computers. It is correct to about 14 decimal places. AutoIt gets its math from the C++ libraries used to write and compile the interpreter. 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