# 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.

##### Share on other sites

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

##### 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

## Create an account

Register a new account