Re: UniBasic code that should work
- From: "Mike Preece" <michael@xxxxxxxxxx>
- Date: 28 Mar 2006 19:13:38 -0800
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?
.
- Follow-Ups:
- Re: UniBasic code that should work
- From: bgraetz
- Re: UniBasic code that should work
- From: Excalibur
- Re: UniBasic code that should work
- References:
- UniBasic code that should work
- From: Mike Preece
- UniBasic code that should work
- Prev by Date: Re: aix compressed psuedo floppies
- Next by Date: Re: UniBasic code that should work
- Previous by thread: Re: UniBasic code that should work
- Next by thread: Re: UniBasic code that should work
- Index(es):
Relevant Pages
|