× 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.



> 
> I've recently observed that a 2-byte binary variable that is a field
> within a data structure apparently gets clamped to 4 digits, even
though
> the natural floor and ceiling for a 2-byte signed binary are -32768
and
> +32767.

4B0 is not equivalent to 5I0, which is why there are two different data
types.  Why do it this way?  The closest I can figure is that binary
data types were meant to be simply another form of decimal data, like
packed or zoned.  With decimal numbers, when you add 1 to a four-digit
field containing 9999, you get 0.  Thus the "ceiling" at 9999.  My guess
is the floor is -9999.  That also explains why a 2-byte binary field is
specified as 4B0 - it can hold up to four digits of data.

Conversely, the size of integer field types I and U indicates the number
of bytes in the field.  So if you want integer arithmetic, use the
integer field types, either I or U.  The unfortunately named binary
field type B is pretty much obsolete at this point in time.

Joe


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.