Sign in to follow this  
Followers 0
TimothyCricket

basic math problem

3 posts in this topic

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.

Share this post


Link to post
Share on other sites



you could convert the numbers to whole numbers, then subtract, then replace the decimals...


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0