UniBasic code that should work



Posted on behalf of a colleague who wishes to remain nameless...

UniBasic code that should work

The results of the following code are proving to be troublesome:

A = 4.57 + (-4.58)
B = (-0.01)
PRINT 'TEST ONE: ARE ':A:' AND ':B:' THE SAME? ':
IF A = B THEN
PRINT 'YES'
END ELSE
PRINT 'NO'
END

A = OCONV(A,'MD20')
B = OCONV(B,'MD20')
PRINT 'TEST TWO: ARE ':A:' AND ':B:' THE SAME? ':
IF A = B THEN
PRINT 'YES'
END ELSE
PRINT 'NO'
END

You would expect both tests to return 'YES', but in fact, only the
second test returns 'YES'.

TEST ONE: ARE -0.01 AND -0.01 THE SAME? NO
TEST TWO: ARE -0.01 AND -0.01 THE SAME? YES

Is there something simple that I am missing?

.