Subj : PL/I
To : Fred Kantor
From : David Noon
Date : Sat Jan 13 2001 11:02 am
Hi Fred,
Replying to a message of Fred Kantor to David Noon:
FK>> Can PL/I support individual bit operations, and AND, OR, and
FK>> XOR, like Java BigInteger, and also support log, complex
FK>> numbers, etc, on such numbers?
DN>> Yes. PL/I permits the declaration of individual bit variables
DN>> and strings of bits up to 32767 bits long. These do not need to
DN>> be on byte boundaries, but can be forced so by the ALIGNED
DN>> attribute.
FK> Does polymorphism of mathematical operations extend to apply to
FK> those long strings?
Not in general. The mathematical operations are optimized for the floating
point hardware capabilities of the platform. In the case of OS/2 this means
Intel 80x87 NPU and compatibles. Consequently, the precision of the built-in
mathematical functions is usually limited to 10-byte extended precision.
However, the bit manipulation operators will work on bit strings of that
length. So, if you want to roll your own floating point format and produce
mathematical operations up to 32K bits in precision then you can, provided you
are prepared to start from AND, OR, XOR and NOT.
FK> And, can one manipulate single bit by address in such long string?
Yes. The SUBSTR built-in function retrieves an individual bit or substring of
bits; when used as a pseudo-variable it can modify an individual bit or
substring of bits. This function can also be used to pass a substring of bits
to a function or subroutine that has been coded to handle a bit-string
argument. Again, the bit or substring need not be on a byte boundary.
As one might expect, if the compiler cannot resolve the starting position
and/or length of the substring at compile time there is a performance penalty.
But if one is performing arithmetic on 32K bit numbers then one is more
concerned with precision than speed.
Regards
Dave
<Team PL/I>
--- FleetStreet 1.25.1
* Origin: My other computer is an IBM S/390 (2:257/609.5)