John [McKown]:

The answer to the OP's question depends upon whether the length n
under discussion is a length in bytes, as it is and must be in XLn, or
a length in bits.

If the former XL2 is sufficient for either +12500 or unsigned 12500.
If the latter a fullword will be required because 100000 is greater
than either 32767 or 65535.

Since, however, the storage is being declared/allocated in bytes, it
seems clear to me that the length is/ought to be expressed in bytes
too.  I do not see much rationale for your different view in this
particular context.

Note also that your expression for the capacity of a signed halfword
is slightly wrong.  Because twos-complement representations are
used--Zero is its own twos complement--these limits are not
symmetrical.  They are

-2^15 <= H <= +2^15 - 1
-32768 <= H <= +32767.

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to