Affichage des articles dont le libellé est Division giving the wrong answer.. Afficher tous les articles
Affichage des articles dont le libellé est Division giving the wrong answer.. Afficher tous les articles

Division giving the wrong answer.

lundi 20 avril 2015

I’m using this simple code:
Code:


Inch = 45
            MsgBox "" & Inch & " Before"
            Inch = Inch / 12
              MsgBox "" & Inch & " After"

In the two MsgBox that pop up I first get 45 and then after the calculation I get 3.75. This is correct.

But when I put this into the program I’m actually using I get 45 and then 4. Not 3.75. This makes no sense. I have copied and pasted the code from one to the other and then back. It works just fine on the test program but it keeps giving the wrong numbers in the actual program.
I know the starting number is correct, I have it hard coded to be 45. Then the very next line it does the division and then the very next line I get the wrong answer. But it works correctly in the test program. Why is this?
Division giving the wrong answer.

Labels