Jump to content

basic math problem


Recommended Posts

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...