Quote Originally Posted by selbstdual View Post
I changed the code to

Code:
	Second_First = Second_Value - First_Value


	IF Second_First.15=1 THEN
		Difference_First_Second = First - Second
        	Difference_Third_Second = Third - Second
    	ELSE
		Difference_First_Second = Second - First
        	Difference_Third_Second = Second - Third
    	ENDIF

Result:

			Is	Should
First			1386	1386
Second			771	771
Third			882	882
Point_One		449	449
Point_Two		1663	1663
Steps_First_Second	3	380
Steps_Third_Second	14	68
Calculation: Value stored by WRITE:

Value1 Value2
Byte0 Byte1

Value(Like First, Second etc.) = Byte1*256 + Byte0
And again, we've had this conversation before. You're overflowing the limits of your variables. For instance:

x var word
y var word
z var word
x = 1000
y = 1000
z = x * y

You'd expect z to equal 1,000,000, but it work, because it's a word, 16 bits, a word and only a word, 16 bits, nothing more, nothing less. The answer in this case is not 1,000,000, but 16,960. You've either got to learn how to do 32 bit math (which is explained in the PBP manual and will work just fine), or cut down your input numbers a bit to keep them from overflowing the results.