I am using VB5 with speed optimization and have run into a sitution that the compiled code generates an incorrect result. The problem is with the '<' operation. The following code does not compile correctly:
If FLD(NR) < FLD2(NR) THEN
DO THIS
ELSE
DO THAT
END IF
IF FLD(NR) IS FOR EXAMPLE 600 AND FLD2(NR) IS 3000 YOU WOULD EXPECT 'DO THIS' TO EXECUTE, BUT "DO THAT" IS BEING EXECUTED.
This is a different result than if the program is run in development environment where correct result occurs. Also correct without optimization. The code also seems to work if <= is used, but that's not what I'm thying to test.
Has anyone run into this problem and is there a solution other than changing all the code in a very large system?
If FLD(NR) < FLD2(NR) THEN
DO THIS
ELSE
DO THAT
END IF
IF FLD(NR) IS FOR EXAMPLE 600 AND FLD2(NR) IS 3000 YOU WOULD EXPECT 'DO THIS' TO EXECUTE, BUT "DO THAT" IS BEING EXECUTED.
This is a different result than if the program is run in development environment where correct result occurs. Also correct without optimization. The code also seems to work if <= is used, but that's not what I'm thying to test.
Has anyone run into this problem and is there a solution other than changing all the code in a very large system?