TimothyCricket Posted February 21, 2009 Share Posted February 21, 2009 Hey guys, please run this code and see what happens If (5.8492 - 5.8491) = 0.0001 Then MsgBox(0,"Yes. It is 0.0001","congratulations, you may now move on to the 2nd grade :)") Exit Else MsgBox(0,"No. It's not 0.0001","5.8492 - 5.8491 = " & 5.8492 - 5.8491) Exit EndIf I included some sarcasm in the code above just to have some fun with it. But in reality, I know that this is NOT a bug, and that autoit is "scientifically" correct. So I'm not here to question why this is happening or to say this needs to be fixed. What I am here for, is to find out if there is a way (or a function) which will give me the "accepted" answer and not the scientific answer. I'm working a small calculator type of program that will do some basic math for me with some numbers that I give it. And the whole thing is useless if 5.8492 - 5.8491 does not equal 0.0001 That is not the only equation where autoit gives me the scientific answer. It happens plenty of times with the numbers I work with. I just posted this one as the example since it is really basic. So as you can imagine... it's pretty hard to code mathematical application when the results are not what a human expects. Is there any way to convert the output that autoit gives me? Or is there a function like Subtract($number1,$number2) that behaves like a normal everyday calculator? Thanks everyone. Link to comment Share on other sites More sharing options...
seandisanti Posted February 21, 2009 Share Posted February 21, 2009 you could convert the numbers to whole numbers, then subtract, then replace the decimals... Link to comment Share on other sites More sharing options...
crapmail Posted February 21, 2009 Share Posted February 21, 2009 see this threadhttp://www.autoitscript.com/forum/index.ph...al+float+doubleAlways search first Curently writing a autoit installerAutoit installer 83 and 2 thirds%-template 100%-script syntax 100%-script parser 50%--error checking 100%--actual parsing 50%--combining template and parsed crap 0%Template.au3 - 4.15kbparser.au3 - 1.94kb 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