Re: UniBasic code that should work



My colleague has accepted that he has to put oconvs around the values.
I'm sure he's not totally happy with that - but it works.

As for me - I am appalled! It's not nice to realise that there is a ton
of code out there that I have written over the years that will break if
migrated to dUniData or dUniVerse. It's ridiculous for 4.57 minus 4.58
not to equal zero minus .01. If this is "wide zero" then wide zero is a
pile of poo.

Mike.

Excalibur wrote:

Hi
Welcome to the world of wide zero. Always do conversions before
comparisons. Openqm has a flag to force rounding at a reasonable level and
I suspect so does Unidata. D3 uses x significant digits (16 I think) so
skips the problem in normal maths.
Regards
Peter McMurray
"Mike Preece" <michael@xxxxxxxxxx> wrote in message
news:1143593229.817870.273060@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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?


.



Relevant Pages

  • Re: deleting rows with zero value
    ... with zero in each cell in C. col. ... The routine is that each country ... colleague fills the items they use, leaving zero in those they don't ... Should be the normal routine. ...
    (microsoft.public.excel.programming)
  • Re: John Baez teaches calculus.
    ... accuses a colleague of dividing by zero. ... that aims to ridicule this colleague. ...
    (sci.physics.relativity)