× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Mon, Aug 22, 2016 at 4:42 PM, CRPence <crpbottle@xxxxxxxxx> wrote:
On 22-Aug-2016 12:35 -0700, Vernon Hamberg wrote:

The result is meaningless if data types don't match (other than
zoned and character, maybe), since it is a hexadecimal comparison.
Basically, all data types should be the same.

More appropriately than "should be", I would suggest, is that the
data-type and [notably length\scale] attributes *must* be _identical_ for
the two arguments.

Actually, it's even worse than that.

Not only must the types of all the arguments be identical, they must
be from a subset of the available types, or the arguments must meet
other restrictions, such as all being the same sign, or all being
positive.

Vern, I assume you compiled and ran the code you posted. Did you try
other test cases? In particular, did you try comparing a positive
number with smaller absolute value against a negative number with
larger absolute value? For example, 3 versus -14?

Did you try floats or binary signed integers?

I don't have the time to try it out myself, but I think you will find
that this scheme doesn't work for signed numeric data in general. The
BCD types (packed and zoned) have their sign in the least significant
byte, so absolute value generally trumps sign. (Zoned adds a little
wrinkle, because the sign is in the next-to-least significant nibble.)

Meanwhile, the binary signed types have the sign in the most
significant bit, but use '1' for negative, making all negative numbers
"higher" (in bit pattern) than all positive numbers.

Vern, it was a clever and valiant attempt, but in my opinion, that
approach is ultimately of limited usefulness.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.